Skip to content

Instantly share code, notes, and snippets.

@butsugiri
Created August 3, 2022 02:42
Show Gist options
  • Save butsugiri/8b56bc94122a720d1c9c7f47277ccbc6 to your computer and use it in GitHub Desktop.
Save butsugiri/8b56bc94122a720d1c9c7f47277ccbc6 to your computer and use it in GitHub Desktop.
zz() {
[ $# -gt 0 ] && z "$*" && return
cd "$(z -l 2>&1 | fzf --height 40% --nth 2.. --reverse --inline-info +s --tac --query "${*##-* }" | sed 's/^[0-9,.]* *//')"
}
zz-accept() {
zz
zle accept-line
}
zle -N zz-accept
bindkey '\el' zz-accept
@butsugiri
Copy link
Author

autoload -Uz chpwd_recent_dirs cdr add-zsh-hook
add-zsh-hook chpwd chpwd_recent_dirs
zstyle ':completion:*:*:cdr:*:*' menu selection
zstyle ':chpwd:*' recent-dirs-max 100
zstyle ':chpwd:*' recent-dirs-default true
zstyle ':chpwd:*' recent-dirs-insert true
zstyle ':chpwd:*' recent-dirs-file "${HOME}/.chpwd-recent-dirs"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment