My build of nnn with minor changes
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

27 line
800 B

  1. #!/usr/bin/env sh
  2. # Description: cd to any dir in the z database using an fzf pane
  3. #
  4. # Shell: POSIX compliant
  5. # Author: Nick Waywood
  6. . "$(dirname "$0")"/.nnn-plugin-helper
  7. if which fzf >/dev/null 2>&1; then
  8. fuzzy=fzf
  9. else
  10. exit 1
  11. fi
  12. datafile="${_Z_DATA:-$HOME/.z}"
  13. if [ -f "$datafile" ]; then
  14. # I read the data from z's file instead of calling the z command so that the data doesn't need to be processed twice
  15. sel=$(awk -F "|" '{print $1}' "$datafile" | "$fuzzy" | awk '{$1=$1};1')
  16. # NOTE: Uncomment this line and comment out the line above if you want to see the weightings of the dir's in the fzf pane
  17. # sel=$(awk -F "|" '{printf "%s %s\n", $2, $1}' "$datafile" | "$fuzzy" | sed 's/^[0-9,.]* *//' | awk '{$1=$1};1')
  18. else
  19. exit 1
  20. fi
  21. printf "%s" "0c$sel" > "$NNN_PIPE"