diff options
| -rw-r--r-- | .config/zsh/completion.zsh | 80 |
1 files changed, 27 insertions, 53 deletions
diff --git a/.config/zsh/completion.zsh b/.config/zsh/completion.zsh index baa0bc5..f050351 100644 --- a/.config/zsh/completion.zsh +++ b/.config/zsh/completion.zsh @@ -1,72 +1,46 @@ -# From https://wiki.archlinux.org/index.php/Zsh - -### Keep the space after completion for some characters in zsh -#from https://unix.stackexchange.com/a/174641 ZLE_SPACE_SUFFIX_CHARS=$'|&' -### Handle command not found -if [ -e /usr/share/doc/pkgfile/command-not-found.zsh ]; then - source /usr/share/doc/pkgfile/command-not-found.zsh -fi +# command-not-found +[[ -r /usr/share/zsh/plugins/pkgfile/command-not-found.zsh ]] && + source /usr/share/zsh/plugins/pkgfile/command-not-found.zsh -### For autocompletion with an arrow-key driven interface +# UI zstyle ':completion:*' menu select +#zstyle ':completion:*' group-name '' +zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS} -### For autocompletion of command line switches for aliases +# alias completion setopt complete_aliases -### For enabling autocompletion of privileged environments in privileged commands +# privilege completion zstyle ':completion::complete:*' gain-privileges 1 -### Use cache +# cache zstyle ':completion:*' use-cache on -zstyle ':completion:*' cache-path ~/.cache/zsh/cache - -### Prevent CVS files/directories from being completed -zstyle ':completion:*:(all-|)files' ignored-patterns '(|*/)CVS' -zstyle ':completion:*:cd:*' ignored-patterns '(*/)#CVS' +zstyle ':completion:*' cache-path ~/.cache/zsh/completion -### The number of errors allowed by _approximate to increase with the length of -### what you have typed so far -zstyle -e ':completion:*:approximate:*' \ - max-errors 'reply=($((($#PREFIX+$#SUFFIX)/3))numeric)' +# matching +zstyle ':completion:*' matcher-list \ + 'm:{a-zA-Z}={A-Za-z}' \ + 'r:|=*' \ + 'l:|=*' -### Ignore completion functions for commands you don't have -zstyle ':completion:*:functions' ignored-patterns '_*' - -### With helper functions -xdvi() { command xdvi ${*:-*.dvi(om[1])} } +setopt complete_in_word +setopt auto_cd -### you can avoid having to complete at all in many cases, but if you do, you -### might want to fall into menu selection immediately andto have the words -### sorted by time: -zstyle ':completion:*:*:xdvi:*' menu yes select -zstyle ':completion:*:*:xdvi:*' file-sort time +# ignore junk +zstyle ':completion:*:(all-|)files' ignored-patterns '(|*/)CVS' +zstyle ':completion:*:cd:*' ignored-patterns '(*/)#CVS' -### Completing process IDs with menu selection +# process completion zstyle ':completion:*:*:kill:*' menu yes select -zstyle ':completion:*:kill:*' force-list always -zstyle ':completion:*:processes' command 'ps -A -o pid,user,comm -w -w' +zstyle ':completion:*:processes' command 'ps -eo pid,user,comm --sort=-%mem' -### If you end up using a directory as argument, this will remove the trailing slash +# misc zstyle ':completion:*' squeeze-slashes true - -### cd will never select the parent directory zstyle ':completion:*:cd:*' ignore-parents parent pwd +zstyle ':completion:*' rehash false -### cd without cd -setopt auto_cd - -### Complete from middle of filename -#zstyle ':completion:*' matcher-list '' 'm:{[:lower:][:upper:]}={[:upper:][:lower:]}' '+l:|=* r:|=*' -setopt complete_in_word - -### auto rehash -zstyle ':completion:*' rehash true - -### add colors -zstyle ':completion:*' menu select list-colors ${(s.:.)LS_COLORS} - -### completion and prompt init -autoload -Uz compinit colors vcs_info -compinit +# init +autoload -Uz compinit +compinit -C -d ~/.cache/zsh/zcompdump |
