From 00966df0497f76c3af603483606a13a3303933df Mon Sep 17 00:00:00 2001 From: Alpha Chen Date: Thu, 10 Oct 2024 20:20:07 -0700 Subject: [PATCH] zoxide + fzf --- .zshrc | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/.zshrc b/.zshrc index 8cd5bb7..dc2265e 100644 --- a/.zshrc +++ b/.zshrc @@ -166,6 +166,18 @@ fi # has to go after compinit if (( $+commands[zoxide] )); then eval "$(zoxide init zsh)" + + # https://junegunn.github.io/fzf/examples/directory-nagivation/#integration-with-fzf + # https://junegunn.github.io/fzf/examples/directory-nagivation/#zoxidehttpsgithubcomajeetdsouzazoxide + unalias z 2> /dev/null + z() { + local dir=$( + zoxide query --list --score | + fzf --height 40% --layout reverse --info inline \ + --nth 2.. --tac --no-sort --query "$*" \ + --bind 'enter:become:echo {2..}' + ) && cd "$dir" + } fi # Define named directories: ~w <=> Windows home directory on WSL.