My build of nnn with minor changes
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.
 
 
 
 
 
 

32 lines
769 B

  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. else
  26. printf "jump/autojump missing"
  27. read -r _
  28. fi