|
|
@ -3,53 +3,81 @@ if [[ "$TERM" == 'dumb' ]]; then
|
|
|
|
return
|
|
|
|
return
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
unsetopt menu_complete # Do not autoselect the first completion entry.
|
|
|
|
|
|
|
|
unsetopt flow_control # Disable start/stop characters in shell editor.
|
|
|
|
|
|
|
|
setopt auto_menu # Show completion menu on a succesive tab press.
|
|
|
|
|
|
|
|
setopt complete_in_word # Complete from both ends of a word.
|
|
|
|
setopt complete_in_word # Complete from both ends of a word.
|
|
|
|
setopt always_to_end # Move cursor to the end of a completed word.
|
|
|
|
setopt always_to_end # Move cursor to the end of a completed word.
|
|
|
|
|
|
|
|
setopt path_dirs # Perform path search even on command names with slashes.
|
|
|
|
|
|
|
|
setopt auto_menu # Show completion menu on a succesive tab press.
|
|
|
|
|
|
|
|
setopt auto_list # Automatically list choices on ambiguous completion.
|
|
|
|
|
|
|
|
setopt auto_param_slash # If completed parameter is a directory, add a trailing slash.
|
|
|
|
|
|
|
|
unsetopt menu_complete # Do not autoselect the first completion entry.
|
|
|
|
|
|
|
|
unsetopt flow_control # Disable start/stop characters in shell editor.
|
|
|
|
|
|
|
|
|
|
|
|
WORDCHARS=''
|
|
|
|
# Treat these characters as part of a word.
|
|
|
|
|
|
|
|
WORDCHARS='*?_-.[]~&;!#$%^(){}<>'
|
|
|
|
|
|
|
|
|
|
|
|
# FIXME: complist is crashing ZSH on menu completion.
|
|
|
|
# Use caching to make completion for cammands such as dpkg and apt usable.
|
|
|
|
# zmodload -i zsh/complist
|
|
|
|
zstyle ':completion::complete:*' use-cache on
|
|
|
|
|
|
|
|
zstyle ':completion::complete:*' cache-path .zcache
|
|
|
|
|
|
|
|
|
|
|
|
## Case-insensitive (all), partial-word, and then substring completion.
|
|
|
|
# Case-insensitive (all), partial-word, and then substring completion.
|
|
|
|
if [[ "$CASE_SENSITIVE" == "true" ]]; then
|
|
|
|
if check-bool "$CASE_SENSITIVE"; then
|
|
|
|
zstyle ':completion:*' matcher-list 'r:|[._-]=* r:|=*' 'l:|=* r:|=*'
|
|
|
|
zstyle ':completion:*' matcher-list 'r:|[._-]=* r:|=*' 'l:|=* r:|=*'
|
|
|
|
unset CASE_SENSITIVE
|
|
|
|
setopt case_glob
|
|
|
|
else
|
|
|
|
else
|
|
|
|
zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}' 'r:|[._-]=* r:|=*' 'l:|=* r:|=*'
|
|
|
|
zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}' 'r:|[._-]=* r:|=*' 'l:|=* r:|=*'
|
|
|
|
|
|
|
|
unsetopt case_glob
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
zstyle ':completion:*' list-colors ''
|
|
|
|
# Group matches and describe.
|
|
|
|
|
|
|
|
zstyle ':completion:*:*:*:*:*' menu select
|
|
|
|
|
|
|
|
zstyle ':completion:*:matches' group 'yes'
|
|
|
|
|
|
|
|
zstyle ':completion:*:options' description 'yes'
|
|
|
|
|
|
|
|
zstyle ':completion:*:options' auto-description '%d'
|
|
|
|
|
|
|
|
zstyle ':completion:*:corrections' format ' %F{green}-- %d (errors: %e) --%f'
|
|
|
|
|
|
|
|
zstyle ':completion:*:descriptions' format ' %F{yellow}-- %d --%f'
|
|
|
|
|
|
|
|
zstyle ':completion:*:messages' format ' %F{purple} -- %d --%f'
|
|
|
|
|
|
|
|
zstyle ':completion:*:warnings' format ' %F{red}-- no matches found --%f'
|
|
|
|
|
|
|
|
zstyle ':completion:*:default' list-prompt '%S%M matches%s'
|
|
|
|
|
|
|
|
zstyle ':completion:*' format ' %F{yellow}-- %d --%f'
|
|
|
|
|
|
|
|
zstyle ':completion:*' group-name ''
|
|
|
|
|
|
|
|
zstyle ':completion:*' verbose yes
|
|
|
|
|
|
|
|
|
|
|
|
# FIXME: It depends on complist which crashes ZSH on menu completion.
|
|
|
|
# Fuzzy match mistyped completions.
|
|
|
|
# Should this be in key-bindings.zsh?
|
|
|
|
zstyle ':completion:*' completer _complete _match _approximate
|
|
|
|
# bindkey -M menuselect '^o' accept-and-infer-next-history
|
|
|
|
zstyle ':completion:*:match:*' original only
|
|
|
|
|
|
|
|
zstyle ':completion:*:approximate:*' max-errors 1 numeric
|
|
|
|
|
|
|
|
|
|
|
|
zstyle ':completion:*:*:*:*:*' menu select
|
|
|
|
# Increase the number of errors based on the length of the typed word.
|
|
|
|
zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#) ([0-9a-z-]#)*=01;34=0=01'
|
|
|
|
zstyle -e ':completion:*:approximate:*' max-errors 'reply=($((($#PREFIX+$#SUFFIX)/3))numeric)'
|
|
|
|
zstyle ':completion:*:*:*:*:processes' command "ps -u `whoami` -o pid,user,comm -w -w"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Disable named-directories autocompletion.
|
|
|
|
|
|
|
|
zstyle ':completion:*:cd:*' tag-order local-directories directory-stack path-directories
|
|
|
|
|
|
|
|
cdpath=(.)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Use /etc/hosts and known_hosts for hostname completion.
|
|
|
|
|
|
|
|
[ -r ~/.ssh/known_hosts ] && _ssh_hosts=(${${${${(f)"$(<$HOME/.ssh/known_hosts)"}:#[\|]*}%%\ *}%%,*}) || _ssh_hosts=()
|
|
|
|
|
|
|
|
[ -r /etc/hosts ] && : ${(A)_etc_hosts:=${(s: :)${(ps:\t:)${${(f)~~"$(</etc/hosts)"}%%\#*}##[:blank:]#[^[:blank:]]#}}} || _etc_hosts=()
|
|
|
|
|
|
|
|
hosts=(
|
|
|
|
|
|
|
|
"$_ssh_hosts[@]"
|
|
|
|
|
|
|
|
"$_etc_hosts[@]"
|
|
|
|
|
|
|
|
`hostname`
|
|
|
|
|
|
|
|
localhost
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
zstyle ':completion:*:hosts' hosts $hosts
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Use caching to make completion for cammands such as dpkg and apt usable.
|
|
|
|
# Don't complete unavailable commands.
|
|
|
|
zstyle ':completion::complete:*' use-cache 1
|
|
|
|
zstyle ':completion:*:functions' ignored-patterns '(_*|pre(cmd|exec))'
|
|
|
|
zstyle ':completion::complete:*' cache-path ~/.oh-my-zsh/cache/
|
|
|
|
|
|
|
|
|
|
|
|
# Array completion element sorting.
|
|
|
|
|
|
|
|
zstyle ':completion:*:*:-subscript-:*' tag-order indexes parameters
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Directories
|
|
|
|
|
|
|
|
zstyle ':completion:*' list-colors "${(s.:.)LS_COLORS}"
|
|
|
|
|
|
|
|
zstyle ':completion:*:*:cd:*' tag-order local-directories directory-stack path-directories
|
|
|
|
|
|
|
|
zstyle ':completion:*:*:cd:*:directory-stack' menu yes select
|
|
|
|
|
|
|
|
zstyle ':completion:*:-tilde-:*' group-order 'named-directories' 'path-directories' 'users' 'expand'
|
|
|
|
|
|
|
|
zstyle ':completion:*' squeeze-slashes true
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# History
|
|
|
|
|
|
|
|
zstyle ':completion:*:history-words' stop yes
|
|
|
|
|
|
|
|
zstyle ':completion:*:history-words' remove-all-dups yes
|
|
|
|
|
|
|
|
zstyle ':completion:*:history-words' list false
|
|
|
|
|
|
|
|
zstyle ':completion:*:history-words' menu yes
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Environmental Variables
|
|
|
|
|
|
|
|
zstyle ':completion::*:(-command-|export):*' fake-parameters ${${${_comps[(I)-value-*]#*,}%%,*}:#-*-}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Populate hostname completion.
|
|
|
|
|
|
|
|
zstyle -e ':completion:*:hosts' hosts 'reply=(
|
|
|
|
|
|
|
|
${=${${(f)"$(cat {/etc/ssh_,~/.ssh/known_}hosts(|2)(N) 2>/dev/null)"}%%[#| ]*}//,/ }
|
|
|
|
|
|
|
|
${=${(f)"$(cat /etc/hosts(|)(N) <<(ypcat hosts 2>/dev/null))"}%%\#*}
|
|
|
|
|
|
|
|
${=${${${${(@M)${(f)"$(cat ~/.ssh/config 2>/dev/null)"}:#Host *}#Host }:#*\**}:#*\?*}}
|
|
|
|
|
|
|
|
)'
|
|
|
|
|
|
|
|
|
|
|
|
# Don't complete uninteresting users...
|
|
|
|
# Don't complete uninteresting users...
|
|
|
|
zstyle ':completion:*:*:*:users' ignored-patterns \
|
|
|
|
zstyle ':completion:*:*:*:users' ignored-patterns \
|
|
|
@ -59,8 +87,44 @@ zstyle ':completion:*:*:*:users' ignored-patterns \
|
|
|
|
mailman mailnull mldonkey mysql nagios \
|
|
|
|
mailman mailnull mldonkey mysql nagios \
|
|
|
|
named netdump news nfsnobody nobody nscd ntp nut nx openvpn \
|
|
|
|
named netdump news nfsnobody nobody nscd ntp nut nx openvpn \
|
|
|
|
operator pcap postfix postgres privoxy pulse pvm quagga radvd \
|
|
|
|
operator pcap postfix postgres privoxy pulse pvm quagga radvd \
|
|
|
|
rpc rpcuser rpm shutdown squid sshd sync uucp vcsa xfs
|
|
|
|
rpc rpcuser rpm shutdown squid sshd sync uucp vcsa xfs '_*'
|
|
|
|
|
|
|
|
|
|
|
|
# ... unless we really want to.
|
|
|
|
# ... unless we really want to.
|
|
|
|
zstyle '*' single-ignored show
|
|
|
|
zstyle '*' single-ignored show
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Ignore multiple entries.
|
|
|
|
|
|
|
|
zstyle ':completion:*:(rm|kill|diff):*' ignore-line yes
|
|
|
|
|
|
|
|
zstyle ':completion:*:rm:*' file-patterns '*:all-files'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Kill
|
|
|
|
|
|
|
|
zstyle ':completion:*:*:*:*:processes' command 'ps -u $USER -o pid,user,comm -w'
|
|
|
|
|
|
|
|
zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#) ([0-9a-z-]#)*=01;36=0=01'
|
|
|
|
|
|
|
|
zstyle ':completion:*:*:kill:*' menu yes select
|
|
|
|
|
|
|
|
zstyle ':completion:*:*:kill:*' force-list always
|
|
|
|
|
|
|
|
zstyle ':completion:*:*:kill:*' insert-ids single
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Man
|
|
|
|
|
|
|
|
zstyle ':completion:*:manuals' separate-sections true
|
|
|
|
|
|
|
|
zstyle ':completion:*:manuals.(^1*)' insert-sections true
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Media Players
|
|
|
|
|
|
|
|
zstyle ':completion:*:*:mpg123:*' file-patterns '*.(mp3|MP3):mp3\ files *(-/):directories'
|
|
|
|
|
|
|
|
zstyle ':completion:*:*:mpg321:*' file-patterns '*.(mp3|MP3):mp3\ files *(-/):directories'
|
|
|
|
|
|
|
|
zstyle ':completion:*:*:ogg123:*' file-patterns '*.(ogg|OGG|flac):ogg\ files *(-/):directories'
|
|
|
|
|
|
|
|
zstyle ':completion:*:*:mocp:*' file-patterns '*.(wav|WAV|mp3|MP3|ogg|OGG|flac):ogg\ files *(-/):directories'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Mutt
|
|
|
|
|
|
|
|
if [[ -f ~/.mutt/aliases ]]; then
|
|
|
|
|
|
|
|
zstyle ':completion:*:*:mutt:*' menu yes select
|
|
|
|
|
|
|
|
zstyle ':completion:*:mutt:*' users ${${${(f)"$(<~/.mutt/aliases)"}#alias[[:space:]]}%%[[:space:]]*}
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# SSH/SCP/RSYNC
|
|
|
|
|
|
|
|
zstyle ':completion:*:(scp|rsync):*' tag-order 'hosts:-host hosts:-domain:domain hosts:-ipaddr:ip\ address *'
|
|
|
|
|
|
|
|
zstyle ':completion:*:(scp|rsync):*' group-order users files all-files 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 ':completion:*:(ssh|scp|rsync):*:hosts-host' ignored-patterns '*.*' loopback localhost
|
|
|
|
|
|
|
|
zstyle ':completion:*:(ssh|scp|rsync):*:hosts-domain' ignored-patterns '<->.<->.<->.<->' '^*.*' '*@*'
|
|
|
|
|
|
|
|
zstyle ':completion:*:(ssh|scp|rsync):*:hosts-ipaddr' ignored-patterns '^<->.<->.<->.<->' '127.0.0.<->'
|
|
|
|
|
|
|
|
|
|
|
|