My build of nnn with minor changes
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.
 
 
 
 
 
 

42 lignes
1.1 KiB

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