zoxide/zoxide.plugin.zsh

30 lines
511 B
Bash
Raw Normal View History

2020-03-05 13:09:32 +00:00
#!/usr/bin/env sh
_zoxide_precmd() {
zoxide add
}
[[ -n "${precmd_functions[(r)_zoxide_precmd]}" ]] || {
precmd_functions+=(_zoxide_precmd)
}
2020-03-05 13:09:32 +00:00
z() {
if [ $# -ne 0 ]; then
_Z_RESULT=$(zoxide query "$@")
case $_Z_RESULT in
"query: "*)
cd "${_Z_RESULT:7}"
;;
*)
echo "${_Z_RESULT}"
;;
esac
fi
}
alias zi="z -i"
alias za="zoxide add"
alias zq="zoxide query"
alias zr="zoxide remove"