diff options
author | Alan Pearce | 2017-05-18 16:02:35 +0200 |
---|---|---|
committer | Alan Pearce | 2017-05-18 16:02:35 +0200 |
commit | 36b4f758048497cc79ab6855b05f3fd6f1ce6c17 (patch) | |
tree | 9bc6feb8681a00f28b26d7e94d6f0e0369b3472f /zsh | |
parent | 9d60ad2e8270e95549bd4bcecd56aa158fbc4629 (diff) | |
download | nixfiles-36b4f758048497cc79ab6855b05f3fd6f1ce6c17.tar.lz nixfiles-36b4f758048497cc79ab6855b05f3fd6f1ce6c17.tar.zst nixfiles-36b4f758048497cc79ab6855b05f3fd6f1ce6c17.zip |
zsh: Use anyframe as a fzf wrapper
Works around the problem of not being able to use the fzf shell code with zplugin
Diffstat (limited to 'zsh')
-rw-r--r-- | zsh/.config/zsh/.zshrc | 45 |
1 files changed, 10 insertions, 35 deletions
diff --git a/zsh/.config/zsh/.zshrc b/zsh/.config/zsh/.zshrc index c8139f1b..16380e4c 100644 --- a/zsh/.config/zsh/.zshrc +++ b/zsh/.config/zsh/.zshrc @@ -2,9 +2,8 @@ source $ZPLUG_HOME/init.zsh source $HOME/.zplugin/bin/zplugin.zsh -zplug "junegunn/fzf-bin", from:gh-r, as:command, rename-to:fzf -zplug "junegunn/fzf", as:plugin, use:"shell/*.zsh" -zplug "junegunn/fzf", as:command, use:"bin/*" +# zplug "junegunn/fzf", as:plugin, use:"shell/*.zsh" +# zplug "junegunn/fzf", as:command, use:"bin/*" HISTSIZE=3000 SAVEHIST=10000 @@ -126,7 +125,7 @@ zplugin load "zsh-users/zsh-completions" zplugin load "hlissner/zsh-autopair" zplugin load "zdharma/fast-syntax-highlighting" zplugin load "caarlos0/zsh-open-pr" - +zplugin load "mollifier/anyframe" if [[ $os -eq darwin ]] then @@ -244,41 +243,17 @@ else precmd_functions+=(update_window_title) fi -if zplug check junegunn/fzf +if [[ -n $commands[fzf] ]] then - bindkey '^T' transpose-chars - _fzf_compgen_path() { - echo "$1" - command find -L "$1" \ - -name .git -prune -o -name .svn -prune -o \( -type d -o -type f -o -type l \) \ - -a -not -path "$1" -print 2> /dev/null | sed 's@^\./@@' - } - - _fzf_compgen_dir() { - command find -L "$1" \ - -name .git -prune -o -name .svn -prune -o -type d \ - -a -not -path "$1" -print 2> /dev/null | sed 's@^\./@@' - } - fp () { ghq look $(ghq list | fzf +m) } - cd-project-widget () { - local cmd="ghq list" - setopt localoptions pipefail 2> /dev/null - local dir="$(eval "$cmd" | FZF_DEFAULT_OPTS="--height ${FZF_TMUX_HEIGHT:-40%} --reverse $FZF_DEFAULT_OPTS $FZF_ALT_C_OPTS" fzf +m)" - if [[ -z "$dir" ]]; then - zle redisplay - return 0 - fi - cd $(ghq list --full-path | grep "$dir") - local ret=$? - zle reset-prompt - typeset -f zle-line-init >/dev/null && zle zle-line-init - return $ret - } - zle -N cd-project-widget - bindkey '\es' cd-project-widget + + zstyle ":anyframe:selector:fzf:" command "fzf --height 40%" + + bindkey '\es' anyframe-widget-cd-ghq-repository + bindkey '^x^k' anyframe-widget-kill + bindkey '^r' anyframe-widget-put-history fi function function eb-active-environment () { |