My build of nnn with minor changes
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.
 
 
 
 
 
 

37 rindas
661 B

  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