My build of nnn with minor changes
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

4 лет назад
4 лет назад
4 лет назад
123456789101112131415161718192021222324252627282930313233343536
  1. #!/usr/bin/env sh
  2. # Description: Run fzf/fzy, fd/fdfind/find and go to the directory of the file selected
  3. #
  4. # Shell: POSIX compliant
  5. # Author: Anna Arad
  6. . "$(dirname "$0")"/.nnn-plugin-helper
  7. if [ "$(cmd_exists fzy)" -eq "0" ]; then
  8. if [ "$(cmd_exists fd)" -eq "0" ]; then
  9. fd=fd
  10. elif [ "$(cmd_exists fdfind)" -eq "0" ]; then
  11. fd=fdfind
  12. else
  13. fd=find
  14. fi
  15. sel=$($fd | fzy)
  16. elif [ "$(cmd_exists fzf)" -eq "0" ]; then
  17. sel=$(fzf)
  18. else
  19. exit 1
  20. fi
  21. if [ -n "$sel" ]; then
  22. if ! [ -d "$sel" ]; then
  23. sel=$(dirname "$sel")
  24. elif [ "$sel" = "." ]; then
  25. exit 0
  26. fi
  27. # Remove "./" prefix if it exists
  28. sel="${sel#./}"
  29. nnn_cd "$PWD/$sel"
  30. fi