From 566a28c29703799410576a03ed474abc5e43423c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yaroslav=20de=20la=20Pe=C3=B1a=20Smirnov?= Date: Tue, 26 Oct 2021 15:34:07 +0300 Subject: lf: open files with fzf --- dotfiles/.config/lf/lfrc | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) (limited to 'dotfiles/.config/lf') diff --git a/dotfiles/.config/lf/lfrc b/dotfiles/.config/lf/lfrc index 51115c2..5b9854c 100644 --- a/dotfiles/.config/lf/lfrc +++ b/dotfiles/.config/lf/lfrc @@ -52,13 +52,24 @@ cmd extract ${{ # change dir with fzf cmd fzf_jump ${{ - res="$(find . -type d | fzf --header='Jump to location')" - if [ -d "$res" ]; then - cmd="cd" - else - cmd="select" - fi - lf -remote "send $id $cmd \"$res\"" + res="$(find . -type d | fzf --header='Jump to location')" + if [ -d "$res" ]; then + cmd="cd" + else + cmd="select" + fi + lf -remote "send $id $cmd \"$res\"" +}} + +# open file with fzf +cmd fzf_open ${{ + res="$(find . -type d -path "*/\.*" -prune -o -not -name ".*" -type f | fzf)" + if [ -e "$res" ]; then + cmd="mimeo" + else + cmd="select" + fi + $cmd "$res" }} # drag and drop prompt @@ -87,6 +98,7 @@ map shell map D delete map shell map f :fzf_jump +map o :fzf_open map t :dragon map T :dragon_drop map W $setsid $TERMINAL > /dev/null 2>&1 & # open new terminal window -- cgit v1.2.3