diff options
Diffstat (limited to 'plugins/fzopen')
| -rwxr-xr-x | plugins/fzopen | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/plugins/fzopen b/plugins/fzopen index 046e7e9..91a504d 100755 --- a/plugins/fzopen +++ b/plugins/fzopen @@ -4,10 +4,20 @@ # 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 -entry="$(find . -type f 2>/dev/null | fzy)" +if which fzf >/dev/null 2>&1; then + fuzzy=fzf +elif which fzy >/dev/null 2>&1; then + fuzzy=fzy +else + exit 1 +fi + +entry="$(find . -type f 2>/dev/null | "$fuzzy")" case "$(file -biL "$entry")" in *text*) |