aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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