Reputation: 26
I want the zsh-autocomplete magic to work when when I do cd ..TAB
to automatically recognize it as ../ and run fzf. If I just write cd ../TAB
it works normally but I know it is possible because it was on my previous config by default(zsh-autocomplete was just installed as a plugin in ohmyzsh) so I cant figure out how they set it up.
this is my current .zshrc
if [ ! -d "$ANTIDOTE_HOME" ]; then
mkdir -p "$ANTIDOTE_HOME"
git clone --depth=1 https://github.com/mattmc3/antidote.git "$ANTIDOTE_HOME"
fi
source "${ANTIDOTE_HOME}/antidote.zsh"
antidote load
#autoload -Uz promptinit && promptinit && prompt starship
# call compinit onlz once per day for better performance
autoload -Uz compinit
if [ $(date +'%j') != $(stat -c '%z' ~/.zcompdump | date +'%j') ]; then
compinit
else
compinit -C
fi
_comp_options+=(globdots)
eval "$(starship init zsh)"
bindkey "^[[1;5C" forward-word
bindkey "^[[1;5D" backward-word
bindkey '^[[A' history-substring-search-up
bindkey '^[OA' history-substring-search-up
bindkey '^[[B' history-substring-search-down
bindkey '^[OB' history-substring-search-down
HISTSIZE=5000
HISTFILE=~/.zsh_history
SAVEHIST=$HISTSIZE
HISTDUP=erase
setopt appendhistory
setopt sharehistory
setopt hist_ignore_space
setopt hist_ignore_all_dups
setopt hist_save_no_dups
setopt hist_ignore_dups
setopt hist_find_no_dups
zstyle ':completion:*' completer _expand _complete _ignored _approximate
zstyle ':completion:*' matcher-list 'm:{a-z}={A-Za-z}'
zstyle ':completion:*' matcher-list 'r:|=*' 'l:|=* r:|=*'
# Autocomplete colors
#if [[ -z "$LS_COLORS" ]]; then
# (( $+commands[dircolors] )) && eval "$(dircolors -b)"
#fi
#https://askubuntu.com/questions/466198/how-do-i-change-the-color-for-directories-with-ls-in-the-console
LS_COLORS=$LS_COLORS:'di=1;36:' ; export LS_COLORS
zstyle ':completion:*' list-colors "${(s.:.)LS_COLORS}"
zstyle ':completion:*' menu no
zstyle ':completion:*:git-checkout:*' sort false
zstyle ':fzf-tab:complete:cd:*' fzf-preview 'ls --color $realpath'
# check if fzf version is equal or higher then 0.48.0
fzf_version=$(fzf --version | grep -Eo '[0-9]+\.[0-9]+\.[0-9]+')
IFS='.' read -r major minor patch <<< "$fzf_version"
if [[ $major -ge 0 && $minor -ge 48 && $patch -ge 0 ]]; then
eval "$(fzf --zsh)"
else
source "/usr/share/doc/fzf/examples/completion.zsh"
source "/usr/share/doc/fzf/examples/key-bindings.zsh"
zstyle ':fzf-tab:*' fzf-bindings-default 'tab:down,btab:up,change:top,ctrl-space:toggle,bspace:backward-delete-char,ctrl-h:backward-delete-char'
fi
I've tried adding:
_dotdot() {
echo "Custom completion triggered"
compadd ../
}
compdef _dotdot ..
but it did not fix it.
Upvotes: 0
Views: 122