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.
 
 
 
 
 
 

36 rindas
1.0 KiB

  1. #!/usr/bin/env sh
  2. # Description: Fuzzy find a file in directory subtree with fzy
  3. # Opens in $VISUAL or $EDITOR if text
  4. # Opens other type of files with xdg-open
  5. #
  6. # Requires: fd/find, fzf/fzy/skim, xdg-open
  7. #
  8. # Shell: POSIX compliant
  9. # Author: Arun Prakash Jana
  10. if which fzf >/dev/null 2>&1; then
  11. cmd="$FZF_DEFAULT_COMMAND"
  12. if which fd >/dev/null 2>&1; then
  13. [ -z "$cmd" ] && cmd="fd -t f 2>/dev/null"
  14. else
  15. [ -z "$cmd" ] && cmd="find . -type f 2>/dev/null"
  16. fi
  17. entry="$(eval "$cmd" | fzf --delimiter / --nth=-1 --tiebreak=begin --info=hidden)"
  18. # To show only the file name
  19. # entry=$(find . -type f 2>/dev/null | fzf --delimiter / --with-nth=-1 --tiebreak=begin --info=hidden)
  20. elif which fzy >/dev/null 2>&1; then
  21. entry=$(find . -type f 2>/dev/null | fzy)
  22. elif which sk >/dev/null 2>&1; then
  23. entry=$(find . -type f 2>/dev/null | sk)
  24. else
  25. exit 1
  26. fi
  27. case "$(file -biL "$entry")" in
  28. *text*)
  29. "${VISUAL:-$EDITOR}" "$entry" ;;
  30. *)
  31. xdg-open "$entry" >/dev/null 2>&1 ;;
  32. esac