Skip to content

Commit

Permalink
Tweak fzopen to show parent dir and filename with fzf
Browse files Browse the repository at this point in the history
  • Loading branch information
jarun committed Feb 20, 2020
1 parent 9f1b51b commit a1b8631
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions plugins/fzopen
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@
# Author: Arun Prakash Jana

if which fzf >/dev/null 2>&1; then
fuzzy=fzf
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
fuzzy=fzy
entry=$(find . -type f 2>/dev/null | fzy)
else
exit 1
fi

entry="$(find . -type f 2>/dev/null | "$fuzzy")"

case "$(file -biL "$entry")" in
*text*)
"${VISUAL:-$EDITOR}" "$entry" ;;
Expand Down

0 comments on commit a1b8631

Please sign in to comment.