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.
 
 
 
 
 
 

32 lignes
946 B

  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: fzf/fzy, 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. [ -z "$cmd" ] && cmd="find . -type f 2>/dev/null"
  13. entry="$(eval "$cmd" | fzf --delimiter / --nth=-1 --tiebreak=begin --info=hidden)"
  14. # To show only the file name
  15. # entry=$(find . -type f 2>/dev/null | fzf --delimiter / --with-nth=-1 --tiebreak=begin --info=hidden)
  16. elif which fzy >/dev/null 2>&1; then
  17. entry=$(find . -type f 2>/dev/null | fzy)
  18. elif which sk >/dev/null 2>&1; then
  19. entry=$(find . -type f 2>/dev/null | sk)
  20. else
  21. exit 1
  22. fi
  23. case "$(file -biL "$entry")" in
  24. *text*)
  25. "${VISUAL:-$EDITOR}" "$entry" ;;
  26. *)
  27. xdg-open "$entry" >/dev/null 2>&1 ;;
  28. esac