nnn/plugins/fzopen
Arun Prakash Jana 1cca9e4b72
shellcheck fixes
2019-11-22 11:13:34 +05:30

18 lines
431 B
Bash
Executable file

#!/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
#
# Shell: POSIX compliant
# Author: Arun Prakash Jana
entry="$(find . -type f 2>/dev/null | fzy)"
case "$(file -biL "$entry")" in
*text*)
"${VISUAL:-$EDITOR}" "$entry" ;;
*)
xdg-open "$entry" >/dev/null 2>&1 ;;
esac