My build of nnn with minor changes
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
- #!/usr/bin/env sh
-
- # Description: Fuzzy find a file in directory subtree with fzy
- # Opens in $VISUAL or $EDITOR if text
- # Opens other type of files with xdg-open
- #
- # Requires: fzf/fzy, xdg-open
- #
- # Shell: POSIX compliant
- # Author: Arun Prakash Jana
-
- if which fzf >/dev/null 2>&1; then
- entry=$(find . -type f 2>/dev/null | fzf --delimiter / --nth=-1 --tiebreak=begin --info=hidden)
- # To show only the file name
- # entry=$(find . -type f 2>/dev/null | fzf --delimiter / --with-nth=-1 --tiebreak=begin --info=hidden)
- elif which fzy >/dev/null 2>&1; then
- entry=$(find . -type f 2>/dev/null | fzy)
- else
- exit 1
- fi
-
- case "$(file -biL "$entry")" in
- *text*)
- "${VISUAL:-$EDITOR}" "$entry" ;;
- *)
- xdg-open "$entry" >/dev/null 2>&1 ;;
- esac
|