Mostly improving fzf tab on-word complete

This commit is contained in:
Jonathan Hodgson 2020-05-08 20:42:26 +01:00
parent ac48d66ff8
commit f2251d9af5
4 changed files with 151 additions and 188 deletions

View file

@ -1,3 +1,5 @@
fpath=("${ZSH_FOLDER}completion" $fpath)
# Make completion work
autoload -U compinit
zstyle ':completion:*' menu select
@ -19,30 +21,11 @@ compdef sshrc=ssh
compdef v=vim
compdef vi=vim
autoload bashcompinit
bashcompinit
_wp_complete() {
local OLD_IFS="$IFS"
local cur=${COMP_WORDS[COMP_CWORD]}
IFS=$'\n'; # want to preserve spaces at the end
local opts="$(wp cli completions --line="$COMP_LINE" --point="$COMP_POINT")"
if [[ "$opts" =~ \<file\>\s* ]]
then
COMPREPLY=( $(compgen -f -- $cur) )
elif [[ $opts = "" ]]
then
COMPREPLY=( $(compgen -f -- $cur) )
else
COMPREPLY=( ${opts[*]} )
fi
IFS="$OLD_IFS"
return 0
}
complete -o nospace -F _wp_complete wp
#autoload bashcompinit
#bashcompinit
# Include hidden files in autocomplete:
_comp_options+=(globdots)
fpath=("$ZSH_FOLDER/completion" $fpath)
#source "$ZSH_FOLDER/plugins/fzf-tab/fzf-tab.zsh"