aboutsummaryrefslogtreecommitdiff
path: root/zsh
diff options
context:
space:
mode:
authoreug-vs <eugene@eug-vs.xyz>2022-04-16 18:30:00 +0300
committereug-vs <eugene@eug-vs.xyz>2022-04-16 18:30:16 +0300
commitffb2c05dc51bba581021ca96f4abf5fb00970a34 (patch)
treea7845bcdfa98d3518ca143d60469585263d23668 /zsh
parent02938442ee76e883e36ccd42c62dc1cbc2e1680e (diff)
downloaddotfiles-ffb2c05dc51bba581021ca96f4abf5fb00970a34.tar.gz
feat(zsh): add lfcd function
Diffstat (limited to 'zsh')
-rw-r--r--zsh/.zshrc12
1 files changed, 12 insertions, 0 deletions
diff --git a/zsh/.zshrc b/zsh/.zshrc
index 380d483..e98fd80 100644
--- a/zsh/.zshrc
+++ b/zsh/.zshrc
@@ -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