Last active
March 6, 2019 23:46
-
-
Save marcoy/a66a3284d20a3e76a9f087fac7c3396c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# vim: ts=4 sw=4 | |
# Initialize completion | |
# autoload -Uz compinit | |
# compinit -d "$HOME/.zcompdump" | |
zstyle ':completion::complete:*' use-cache on | |
zstyle ':completion::complete:*' cache-path "$HOME/.zcache" | |
# Enable approximate completions | |
zstyle ':completion:*' completer _complete _ignored _approximate | |
zstyle -e ':completion:*:approximate:*' max-errors 'reply=($((($#PREFIX+$#SUFFIX)/3)) numeric)' | |
# Automatically update PATH entries | |
zstyle ':completion:*' rehash true | |
# Use menu completion | |
zstyle ':completion:*' menu select | |
# Verbose completion results | |
zstyle ':completion:*' verbose true | |
# Smart matching of dashed values, e.g. f-b matching foo-bar | |
zstyle ':completion:*' matcher-list 'r:|[._-]=* r:|=*' | |
# Group results by category | |
zstyle ':completion:*' group-name '' | |
# Don't insert a literal tab when trying to complete in an empty buffer | |
# zstyle ':completion:*' insert-tab false | |
# Keep directories and files separated | |
zstyle ':completion:*' list-dirs-first true | |
# Don't try parent path completion if the directories exist | |
zstyle ':completion:*' accept-exact-dirs true | |
# Always use menu selection for `cd -` | |
zstyle ':completion:*:*:cd:*:directory-stack' force-list always | |
zstyle ':completion:*:*:cd:*:directory-stack' menu yes select | |
# Pretty messages during pagination | |
zstyle ':completion:*' list-prompt '%SAt %p: Hit TAB for more, or the character to insert%s' | |
zstyle ':completion:*' select-prompt '%SScrolling active: current selection at %p%s' | |
# Nicer format for completion messages | |
zstyle ':completion:*:descriptions' format '%U%B%d%b%u' | |
zstyle ':completion:*:corrections' format '%U%F{green}%d (errors: %e)%f%u' | |
zstyle ':completion:*:warnings' format '%F{202}%BSorry, no matches for: %F{214}%d%b' | |
# Show message while waiting for completion | |
zstyle ':completion:*' show-completer true | |
# SSH | |
zstyle ':completion:*' use-ip true | |
zstyle ':completion:*:hosts' hosts $hosts | |
zstyle ':completion:*:(ssh|scp|sshfs|mosh):*' sort false | |
zstyle ':completion:*:(ssh|scp|sshfs|mosh):*' format ' %F{yellow}-- %d --%f' | |
zstyle ':completion:*:(ssh|scp|sshfs|mosh):*' group-name '' | |
zstyle ':completion:*:(ssh|scp|sshfs|mosh):*' verbose yes | |
zstyle ':completion:*:(scp|rsync|sshfs):*' tag-order 'hosts:-host:host hosts:-domain:domain hosts:-ipaddr:ip\ address *' | |
zstyle ':completion:*:(scp|rsync|sshfs):*' group-order users files all-files hosts-domain hosts-host hosts-ipaddr | |
zstyle ':completion:*:(ssh|mosh):*' tag-order 'hosts:-host:host hosts:-domain:domain hosts:-ipaddr:ip\ address *' | |
zstyle ':completion:*:(ssh|mosh):*' group-order users hosts-domain hosts-host users hosts-ipaddr | |
zstyle ':completion:*:(ssh|scp|sshfs|mosh):*:hosts-host' ignored-patterns '*(.|:)*' loopback localhost broadcasthost 'ip6-*' | |
zstyle ':completion:*:(ssh|scp|sshfs|mosh):*:hosts-domain' ignored-patterns '<->.<->.<->.<->' '^[-[:alnum:]]##(.[-[:alnum:]]##)##' '*@*' | |
zstyle ':completion:*:(ssh|scp|sshfs|mosh):*:hosts-ipaddr' ignored-patterns '^(<->.<->.<->.<->|(|::)([[:xdigit:].]##:(#c,2))##(|%*))' '127.0.*' '255.255.255.255' '::1' 'fe80::*' 'ff02::*' | |
# Prettier completion for processes | |
zstyle ':completion:*:*:*:*:processes' force-list always | |
zstyle ':completion:*:*:*:*:processes' menu yes select | |
zstyle ':completion:*:*:*:*:processes' list-colors '=(#b) #([0-9]#) ([0-9a-z-]#)*=01;34=0=01' | |
zstyle ':completion:*:*:*:*:processes' command "ps -u $USER -o pid,user,args -w -w" | |
# Use ls-colors for path completions | |
function _set-list-colors() { | |
zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS} | |
unfunction _set-list-colors | |
} | |
sched 0 _set-list-colors # deferred since LC_COLORS might not be available yet | |
# Don't complete hosts from /etc/hosts | |
zstyle -e ':completion:*' hosts 'reply=()' | |
# Don't complete uninteresting stuff unless we really want to. | |
zstyle ':completion:*:functions' ignored-patterns '(_*|pre(cmd|exec)|TRAP*)' | |
zstyle ':completion:*:*:*:users' ignored-patterns \ | |
adm amanda apache at avahi avahi-autoipd beaglidx bin cacti canna \ | |
clamav daemon dbus distcache dnsmasq dovecot fax ftp games gdm \ | |
gkrellmd gopher hacluster haldaemon halt hsqldb ident junkbust kdm \ | |
ldap lp mail mailman mailnull man messagebus mldonkey mysql nagios \ | |
named netdump news nfsnobody nobody nscd ntp nut nx obsrun openvpn \ | |
operator pcap polkitd postfix postgres privoxy pulse pvm quagga radvd \ | |
rpc rpcuser rpm rtkit scard shutdown squid sshd statd svn sync tftp \ | |
usbmux uucp vcsa wwwrun xfs cron mongodb nullmail portage redis \ | |
shoutcast tcpdump '_*' | |
zstyle ':completion:*' single-ignored show |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment