1
0
Fork 0

more lf wrapper changes

This commit is contained in:
Luca Bilke 2023-06-13 19:13:27 +02:00
parent 043e740380
commit deb6905263
3 changed files with 16 additions and 12 deletions

View file

@ -1,5 +1,18 @@
# vim:set ft=zsh
function lfwrap () {
LF_DIRFILE="/tmp/lfdir.$(uuidgen)"
lfub -last-dir-path="$LF_DIRFILE"
dir="$(cat "$LF_DIRFILE")"
rm "$LF_DIRFILE"
if [ -d "$dir" ]; then
if [ "$dir" != "$(pwd)" ]; then
cd "$dir"
fi
fi
tput cuu1;tput el
}
function _lfwrap () {
BUFFER="lfwrap"
zle accept-line

View file

@ -4,7 +4,6 @@ set -e
UB_PID=0
UB_SOCKET=""
LF_DIRFILE="/tmp/lfdir.$(uuidgen)"
UB_PIDFILE="/tmp/ubpid.$(uuidgen)"
clean () {
@ -13,7 +12,7 @@ clean () {
}
if [ -n "$SSH_CLIENT" ] || [ -n "$SSH_TTY" ]; then
command lf -last-dir-path="$LF_DIRFILE" "$@"
command lf "$@"
else
[ ! -d "$XDG_CACHE_HOME/lf" ] && mkdir --parents "$XDG_CACHE_HOME/lf"
ueberzugpp layer --silent --no-stdin --use-escape-codes --pid-file "$UB_PIDFILE"
@ -22,14 +21,6 @@ else
rm "$UB_PIDFILE"
export UB_PID UB_SOCKET
trap clean HUP INT QUIT TERM PWR EXIT
command lf -last-dir-path="$LF_DIRFILE" "$@" 3>&-
command lf "$@" 3>&-
fi
dir="$(cat "$LF_DIRFILE")"
rm "$LF_DIRFILE"
if [ -d "$dir" ]; then
if [ "$dir" != "$(pwd)" ]; then
cd "$dir"
fi
fi
tput cuu1;tput el

@ -1 +1 @@
Subproject commit ed4e20fe1fc8c72b94c8c38077e308388527786b
Subproject commit 504a8d0199a93ef05e3211ff7ddab86c48acd3f0