diff options
author | eug-vs <eugene@eug-vs.xyz> | 2022-04-16 18:30:00 +0300 |
---|---|---|
committer | eug-vs <eugene@eug-vs.xyz> | 2022-04-16 18:30:16 +0300 |
commit | ffb2c05dc51bba581021ca96f4abf5fb00970a34 (patch) | |
tree | a7845bcdfa98d3518ca143d60469585263d23668 | |
parent | 02938442ee76e883e36ccd42c62dc1cbc2e1680e (diff) | |
download | dotfiles-ffb2c05dc51bba581021ca96f4abf5fb00970a34.tar.gz |
feat(zsh): add lfcd function
-rw-r--r-- | zsh/.zshrc | 12 |
1 files changed, 12 insertions, 0 deletions
@@ -71,6 +71,18 @@ bindkey '^y' fzf-tmux-project zle -N fzf-kill-tmux-project bindkey '^x' fzf-kill-tmux-project +# Use lf to switch directories and bind it to ctrl-o +function lfcd () { + tmp="$(mktemp)" + lf -last-dir-path="$tmp" "$@" + if [ -f "$tmp" ]; then + dir="$(cat "$tmp")" + rm -f "$tmp" >/dev/null + [ -d "$dir" ] && [ "$dir" != "$(pwd)" ] && cd "$dir" + fi +} +bindkey -s '^o' 'lfcd\n' + # Syntax highlighting, must be last source /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh 2> /dev/null |