From 7d0be597ad2791ef223cca732b9e4223879e3dbb Mon Sep 17 00:00:00 2001 From: Arun Prakash Jana Date: Sun, 17 Nov 2019 13:08:26 +0530 Subject: Rename fzy-open to fzopen --- plugins/fzopen | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100755 plugins/fzopen (limited to 'plugins/fzopen') diff --git a/plugins/fzopen b/plugins/fzopen new file mode 100755 index 0000000..97da456 --- /dev/null +++ b/plugins/fzopen @@ -0,0 +1,17 @@ +#!/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 -- cgit v1.2.3-70-g09d2