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.
 
 
 
 
 
 

43 lines
1.2 KiB

  1. #!/usr/bin/env sh
  2. # Description: Navigate to directory using jump/autojump/zoxide
  3. #
  4. # Dependencies: jump - https://github.com/gsamokovarov/jump
  5. # OR autojump - https://github.com/wting/autojump
  6. # OR zoxide - https://github.com/ajeetdsouza/zoxide
  7. #
  8. # Note: The dependencies STORE NAVIGATION PATTERNS
  9. #
  10. # Shell: POSIX compliant
  11. # Authors: Marty Buchaus, Dave Snider, Tim Adler
  12. if [ -z "$NNN_PIPE" ]; then
  13. echo 'ERROR: NNN_PIPE is not set' | ${PAGER:-less}
  14. exit 2
  15. fi
  16. if which jump >/dev/null 2>&1; then
  17. printf "jump to : "
  18. read -r dir
  19. odir="$(jump cd "$dir")"
  20. printf "%s" "0c$odir" > "$NNN_PIPE"
  21. elif which autojump >/dev/null 2>&1; then
  22. printf "jump to : "
  23. read -r dir
  24. odir="$(autojump "$dir")"
  25. printf "%s" "0c$odir" > "$NNN_PIPE"
  26. elif which zoxide >/dev/null 2>&1; then
  27. if which fzf >/dev/null 2>&1; then
  28. odir="$(zoxide query -i --)"
  29. printf "%s" "0c$odir" > "$NNN_PIPE"
  30. else
  31. printf "jump to : "
  32. read -r dir
  33. odir="$(zoxide query -- "$dir")"
  34. printf "%s" "0c$odir" > "$NNN_PIPE"
  35. fi
  36. else
  37. printf "No supported autojump script found. (jump/autojump/zoxide are supported)"
  38. read -r _
  39. fi