From 8fceb7bc4efe451bc80d866059afd12638b436e5 Mon Sep 17 00:00:00 2001 From: Luca Bilke Date: Thu, 1 Feb 2024 11:34:40 +0100 Subject: [PATCH] change opening --- .config/lf/lfrc | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/.config/lf/lfrc b/.config/lf/lfrc index 5ae344a8..3dae8963 100644 --- a/.config/lf/lfrc +++ b/.config/lf/lfrc @@ -11,7 +11,30 @@ set previewer "~/.config/lf/preview/chafa" set cursorpreviewfmt "\033[7;90m" set promptfmt "\033[34;1m%u\033[36m@\033[34m%h \033[35m[\033[0;1m%d\033[35m]\033[32m ยป \033[33m%f\033[0m" -cmd open $set -f; rifle -c $XDG_CONFIG_HOME/lf/rifle.conf -p 0 $fx; clear +cmd open ${{ + set -f + rifle -c $XDG_CONFIG_HOME/lf/rifle.conf -p 0 $f + clear +}} + +cmd pushedit %{{ + echo "Open: " + files=$(read x; echo $x) + lf -remote "send $id unselect" + if sh -c '[ -n "$VIM" ]'; then + lf -remote "send $id vimopen $files" + else + lf -remote "send $id \$echo $files | xargs -or \$EDITOR" + fi +}} + +cmd edit &{{ + if sh -c "[ -n '\$VIM' ]"; then + lf -remote "send $id vimopen $fx" + else + lf -remote "send $id '\$echo $fx | xargs -or nvim +wa'" + fi +}} cmd open-with ${{ method=$(rifle -c $XDG_CONFIG_HOME/lf/rifle.conf -l $fx | fzf | cut -d':' -f1)