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
cmd open ${{
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"
}}
cmd pushedit %{{
set +u
echo "Open: " && read files
echo
echo $files | xargs touch
lf -remote "send $id \$$OPENER $files
send $id unselect"
echo $files | xargs -r touch
if [ -n "$TAOLF" ]; then
lf -remote "send $id toggle $files
send $id open"
else
lf -remote "send $id \$$OPENER $files
send $id unselect"
fi
}}
cmd open-with ${{

View File

@ -1,17 +1,13 @@
#!/bin/sh
# shellcheck disable=2154
[ -n "$TAOLF" ] && {
lf -remote "send $id toggle $(printf "'%s'" "$@"); open"
}
term=
[ -n "$SCRATCHPAD" ] && {
set -- -ft "$@"
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 "$@"
set -- -p0 -c "$XDG_CONFIG_HOME/lf/rifle.conf" "$@"