Merge de1f15f92cc641b9f99d49875d52d4658b6c94b0 into 475e4abb4084008198f1d9a23de6450e02b074a9

This commit is contained in:
Nawar9 2024-06-20 05:23:02 +00:00 committed by GitHub
commit 625c12e87a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -54,13 +54,7 @@ preexec() { echo -ne '\e[5 q' ;} # Use beam shape cursor for each new prompt.
# Use lf to switch directories and bind it to ctrl-o
lfcd () {
tmp="$(mktemp -uq)"
trap 'rm -f $tmp >/dev/null 2>&1 && trap - HUP INT QUIT TERM PWR EXIT' HUP INT QUIT TERM PWR EXIT
lf -last-dir-path="$tmp" "$@"
if [ -f "$tmp" ]; then
dir="$(cat "$tmp")"
[ -d "$dir" ] && [ "$dir" != "$(pwd)" ] && cd "$dir"
fi
cd "$(command lf -print-last-dir "$@")"
}
bindkey -s '^o' '^ulfcd\n'