From 885cfd47345017ca8524c259e53949312360fc8f Mon Sep 17 00:00:00 2001 From: Arun Prakash Jana Date: Mon, 9 Dec 2019 18:36:48 +0530 Subject: Support both fzf and fzy --- plugins/fzopen | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'plugins/fzopen') 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*) -- cgit v1.2.3-70-g09d2