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.
 
 
 
 
 
 

34 lignes
977 B

  1. #!/usr/bin/env sh
  2. # Description: Fuzzy find a file in directory subtree
  3. # Opens in $VISUAL or $EDITOR if text
  4. # Opens other type of files with xdg-open
  5. #
  6. # Dependencies: fd/find, fzf/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 sk >/dev/null 2>&1; then
  21. entry=$(find . -type f 2>/dev/null | sk)
  22. else
  23. exit 1
  24. fi
  25. case "$(file -biL "$entry")" in
  26. *text*)
  27. "${VISUAL:-$EDITOR}" "$entry" ;;
  28. *)
  29. xdg-open "$entry" >/dev/null 2>&1 ;;
  30. esac