zshrc/completion.zsh

74 lines
2.6 KiB
Bash
Raw Normal View History

2010-12-05 16:57:06 +01:00
# @author Sebastian Tramp <mail@sebastian.tramp.name>
# @license http://opensource.org/licenses/gpl-license.php
#
# tab completion configuration
#
# load completions system
zmodload -i zsh/complist
# for all completions: menuselection
zstyle ':completion:*' menu select=1
# for all completions: grouping the output
zstyle ':completion:*' group-name ''
# for all completions: color
zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS}
# for all completions: selected item
#zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS} ma=0\;47
# completion of .. directories
zstyle ':completion:*' special-dirs true
# fault tolerance
zstyle ':completion:*' completer _complete _correct _approximate
# (1 error on 3 characters)
zstyle -e ':completion:*:approximate:*' max-errors 'reply=( $(( ($#PREFIX+$#SUFFIX)/3 )) numeric )'
# case insensitivity
#zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}'
zstyle ":completion:*" matcher-list 'm:{A-Zöäüa-zÖÄÜ}={a-zÖÄÜA-Zöäü}'
# for all completions: grouping / headline / ...
zstyle ':completion:*:messages' format $'\e[01;35m -- %d -- \e[00;00m'
zstyle ':completion:*:warnings' format $'\e[01;31m -- No Matches Found -- \e[00;00m'
zstyle ':completion:*:descriptions' format $'\e[01;33m -- %d -- \e[00;00m'
zstyle ':completion:*:corrections' format $'\e[01;33m -- %d -- \e[00;00m'
# statusline for many hits
zstyle ':completion:*:default' select-prompt $'\e[01;35m -- Match %M %P -- \e[00;00m'
# for all completions: show comments when present
zstyle ':completion:*' verbose yes
# in menu selection strg+space to go to subdirectories
bindkey -M menuselect '^@' accept-and-infer-next-history
# case-insensitive -> partial-word (cs) -> substring completion:
zstyle ':completion:*' matcher-list 'r:|[._-]=* r:|=*' 'l:|=* r:|=*'
# caching of completion stuff
zstyle ':completion:*' use-cache on
zstyle ':completion:*' cache-path "${HOME}/.zsh/${HOST}-cache"
# ~dirs: reorder output sorting: named dirs over userdirs
zstyle ':completion::*:-tilde-:*:*' group-order named-directories users
# ssh: reorder output sorting: user over hosts
zstyle ':completion::*:ssh:*:*' tag-order "users hosts"
# kill: advanced kill completion
zstyle ':completion::*:kill:*:*' command 'ps xf -U $USER -o pid,%cpu,cmd'
zstyle ':completion::*:kill:*:processes' list-colors '=(#b) #([0-9]#)*=0=01;32'
# rm: advanced completion (e.g. bak files first)
zstyle ':completion::*:rm:*:*' file-patterns '*.o:object-files:object\ file *(~|.(old|bak|BAK)):backup-files:backup\ files *~*(~|.(o|old|bak|BAK)):all-files:all\ files'
zstyle :compinstall filename '~/.zshrc'
autoload -Uz compinit && compinit