# ===== init completion autoload -Uz compinit && compinit -d ~/.zsh/cache/zcompdump zmodload -i zsh/complist # ===== setopts # allow completion from within a word or phrase setopt complete_in_word # always complete and display matches immediately after pressing setopt no_list_ambiguous # when completing from the middle of a word, move the cursor to the end. setopt always_to_end # always show completion menu on successive tab press. # (needs unsetopt menu_complete to work) setopt auto_menu # do not autoselect the first completion entry unsetopt menu_complete # ===== completion options # Enable completion caching, use rehash to clear zstyle ':completion::complete:*' use-cache on zstyle ':completion::complete:*' cache-path ~/.zsh/cache/$HOST # Fallback to built in ls colors #zstyle ':completion:*' list-colors '' zstyle ':completion:*' list-colors "${(@s.:.)LS_COLORS}" # Make the list prompt friendly zstyle ':completion:*' list-prompt '%SAt %p: Hit TAB for more, or the character to insert%s' # Make the selection prompt friendly when there are a lot of choices zstyle ':completion:*' select-prompt '%SScrolling active: current selection at %p%s' # Add simple colors to kill zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#) ([0-9a-z-]#)*=01;34=0=01' # list of completers to use zstyle ':completion:*::::' completer _expand _complete _ignored _approximate zstyle ':completion:*' menu select=1 _complete _ignored _approximate # insert all expansions for expand completer # zstyle ':completion:*:expand:*' tag-order all-expansions # match uppercase from lowercase zstyle ':completion:*' matcher-list 'm:{a-z}={A-Z}' # offer indexes before parameters in subscripts zstyle ':completion:*:*:-subscript-:*' tag-order indexes parameters # formatting and messages zstyle ':completion:*' verbose yes zstyle ':completion:*:descriptions' format '%B%d%b' zstyle ':completion:*:messages' format '%d' zstyle ':completion:*:warnings' format 'No matches for: %d' zstyle ':completion:*:corrections' format '%B%d (errors: %e)%b' zstyle ':completion:*' group-name '' # ignore completion functions (until the _ignored completer) zstyle ':completion:*:functions' ignored-patterns '_*' zstyle ':completion:*:scp:*' tag-order files users 'hosts:-host hosts:-domain:domain hosts:-ipaddr"IP\ Address *' zstyle ':completion:*:scp:*' group-order files all-files users hosts-domain hosts-host hosts-ipaddr zstyle ':completion:*:ssh:*' tag-order users 'hosts:-host hosts:-domain:domain hosts:-ipaddr"IP\ Address *' zstyle ':completion:*:ssh:*' group-order hosts-domain hosts-host users hosts-ipaddr zstyle '*' single-ignored show # apt-get recommendations #if [[ $HAS_APT -eq 1 ]]; then # source /etc/zsh_command_not_found #fi