Dotfiles/shells/zsh/includes/lfcd.zsh
Jonathan Hodgson 89dbb2fccf Tweaks to zsh
2024-02-19 07:01:26 +00:00

12 lines
303 B
Bash

# Use lf to switch directories and bind it to ctrl-o
lfcd () {
tmp="$(mktemp)"
lf -last-dir-path="$tmp" "$@"
if [ -f "$tmp" ]; then
dir="$(cat "$tmp")"
rm -f "$tmp"
[ -d "$dir" ] && [ "$dir" != "$(pwd)" ] && cd "$dir"
fi
}
alias lf="lfcd"
#bindkey -s '^o' 'lf\n'