use fasd for smart directory history
This commit is contained in:
parent
f85c2cbf2b
commit
1bcab0ddcb
1 changed files with 16 additions and 5 deletions
21
.zshrc
21
.zshrc
|
@ -88,7 +88,6 @@ if ! zgen saved; then
|
||||||
zgen oh-my-zsh plugins/git-extras
|
zgen oh-my-zsh plugins/git-extras
|
||||||
zgen oh-my-zsh plugins/history-substring-search
|
zgen oh-my-zsh plugins/history-substring-search
|
||||||
|
|
||||||
zgen load uvaes/fzf-marks
|
|
||||||
zgen load miekg/lean
|
zgen load miekg/lean
|
||||||
|
|
||||||
zgen save
|
zgen save
|
||||||
|
@ -144,16 +143,28 @@ bindkey "^[[B" history-substring-search-down
|
||||||
bindkey -M emacs '^P' history-substring-search-up
|
bindkey -M emacs '^P' history-substring-search-up
|
||||||
bindkey -M emacs '^N' history-substring-search-down
|
bindkey -M emacs '^N' history-substring-search-down
|
||||||
|
|
||||||
cd_func ()
|
cd_func () {
|
||||||
{
|
local dir
|
||||||
if [[ $1 == "--" ]]; then
|
if [[ $1 == "--" ]]; then
|
||||||
dirs -v
|
_jump || return 1
|
||||||
return 0
|
return 0
|
||||||
|
elif [[ -z "$1" ]]; then
|
||||||
|
dir="$HOME"
|
||||||
|
else
|
||||||
|
dir="$@"
|
||||||
fi
|
fi
|
||||||
"cd" "$@"
|
"cd" "${dir}"
|
||||||
|
fasd -A $PWD
|
||||||
}
|
}
|
||||||
alias cd=cd_func
|
alias cd=cd_func
|
||||||
|
|
||||||
|
_jump() {
|
||||||
|
dir="$(fasd -Rdl | fzf -1 -0 --no-sort +m --height 10)" && cd_func "${dir}"
|
||||||
|
zle && zle redraw-prompt
|
||||||
|
}
|
||||||
|
zle -N _jump
|
||||||
|
bindkey '^g' _jump
|
||||||
|
|
||||||
## vim
|
## vim
|
||||||
export NVIM_LISTEN_ADDRESS=/tmp/nvimsocket
|
export NVIM_LISTEN_ADDRESS=/tmp/nvimsocket
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue