1
0
Fork 0

lf opener fixes

This commit is contained in:
Luca Bilke 2024-02-22 16:34:43 +01:00
parent 1eba4db0c7
commit 34b3e87a57
2 changed files with 18 additions and 9 deletions

View File

@ -13,16 +13,29 @@ set promptfmt # this is set in a function later
# HACK: This is needed to trigger the opening function of the taolf nvim plugin # HACK: This is needed to trigger the opening function of the taolf nvim plugin
cmd open ${{ cmd open ${{
set +u set +u
[ "$lf_user_multiedit" = "true" ] && { $EDITOR $fx; return; } [ "$lf_user_multiedit" = "true" ] && {
if [ -n "$TAOLF" ]; then
lf -remote "send $id open"
else
$EDITOR $fx
return
fi
}
$OPENER "$f" $OPENER "$f"
}} }}
cmd pushedit %{{ cmd pushedit %{{
set +u
echo "Open: " && read files echo "Open: " && read files
echo echo
echo $files | xargs touch echo $files | xargs -r touch
lf -remote "send $id \$$OPENER $files if [ -n "$TAOLF" ]; then
send $id unselect" lf -remote "send $id toggle $files
send $id open"
else
lf -remote "send $id \$$OPENER $files
send $id unselect"
fi
}} }}
cmd open-with ${{ cmd open-with ${{

View File

@ -1,17 +1,13 @@
#!/bin/sh #!/bin/sh
# shellcheck disable=2154 # shellcheck disable=2154
[ -n "$TAOLF" ] && {
lf -remote "send $id toggle $(printf "'%s'" "$@"); open"
}
term= term=
[ -n "$SCRATCHPAD" ] && { [ -n "$SCRATCHPAD" ] && {
set -- -ft "$@" set -- -ft "$@"
term="$TERMCMD -e" term="$TERMCMD -e"
} }
# HACK: workaround for an nvim/taolf bug with opening empty files # HACK: workaround for a bug with opening empty files in vim
[ "$(rifle -c "$XDG_CONFIG_HOME/lf/rifle.conf" | head -1 | cut -d ':' -f 2)" = "editor" ] && $term vim "$@" [ "$(rifle -c "$XDG_CONFIG_HOME/lf/rifle.conf" | head -1 | cut -d ':' -f 2)" = "editor" ] && $term vim "$@"
set -- -p0 -c "$XDG_CONFIG_HOME/lf/rifle.conf" "$@" set -- -p0 -c "$XDG_CONFIG_HOME/lf/rifle.conf" "$@"