|
|
@ -180,12 +180,19 @@ if (( $+commands[zoxide] )); then
|
|
|
|
# https://junegunn.github.io/fzf/examples/directory-nagivation/#zoxidehttpsgithubcomajeetdsouzazoxide
|
|
|
|
# https://junegunn.github.io/fzf/examples/directory-nagivation/#zoxidehttpsgithubcomajeetdsouzazoxide
|
|
|
|
unalias z 2> /dev/null
|
|
|
|
unalias z 2> /dev/null
|
|
|
|
z() {
|
|
|
|
z() {
|
|
|
|
local dir=$(
|
|
|
|
# (@f) splits command output into array elements by newlines
|
|
|
|
zoxide query --list --score |
|
|
|
|
local results=("${(@f)$(zoxide query --list --score "$*")}")
|
|
|
|
fzf --height 40% --layout reverse --info inline \
|
|
|
|
|
|
|
|
--nth 2.. --no-sort --query "$*" \
|
|
|
|
if (( ${#results} == 1 )); then
|
|
|
|
--bind 'enter:become:echo {2..}'
|
|
|
|
cd "$(awk '{print $NF}' <<< ${results[1]})"
|
|
|
|
) && cd "$dir"
|
|
|
|
else
|
|
|
|
|
|
|
|
local dir=$(
|
|
|
|
|
|
|
|
print -l $results |
|
|
|
|
|
|
|
|
fzf --height 40% --layout reverse --info inline \
|
|
|
|
|
|
|
|
--nth 2.. --no-sort \
|
|
|
|
|
|
|
|
--bind 'enter:become:echo {2..}'
|
|
|
|
|
|
|
|
) && cd "$dir"
|
|
|
|
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
}
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|