My zsh configuration
git clone https://github.com/m-col/zshrc
Files | Refs | Readme

-rw-r--r-- oh-my-zsh/completion.zsh


      1 # Load all stock functions (from $fpath files) called below.
      2 autoload -U compaudit compinit
      3 
      4 if [[ $ZSH_DISABLE_COMPFIX != true ]]; then
      5   # If completion insecurities exist, warn the user
      6   if ! compaudit &>/dev/null; then
      7     handle_completion_insecurities
      8   fi
      9   # Load only from secure directories
     10   compinit -i -d "${ZSH_COMPDUMP}"
     11 else
     12   # If the user wants it, load from all found directories
     13   compinit -u -d "${ZSH_COMPDUMP}"
     14 fi
     15 
     16 # fixme - the load process here seems a bit bizarre
     17 zmodload -i zsh/complist
     18 
     19 WORDCHARS=''
     20 
     21 unsetopt menu_complete   # do not autoselect the first completion entry
     22 unsetopt flowcontrol
     23 setopt auto_menu         # show completion menu on successive tab press
     24 setopt complete_in_word
     25 setopt always_to_end
     26 
     27 # should this be in keybindings?
     28 bindkey -M menuselect '^o' accept-and-infer-next-history
     29 zstyle ':completion:*:*:*:*:*' menu select
     30 
     31 # case insensitive (all), partial-word and substring completion
     32 if [[ "$CASE_SENSITIVE" = true ]]; then
     33   zstyle ':completion:*' matcher-list 'r:|=*' 'l:|=* r:|=*'
     34 else
     35   if [[ "$HYPHEN_INSENSITIVE" = true ]]; then
     36     zstyle ':completion:*' matcher-list 'm:{a-zA-Z-_}={A-Za-z_-}' 'r:|=*' 'l:|=* r:|=*'
     37   else
     38     zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}' 'r:|=*' 'l:|=* r:|=*'
     39   fi
     40 fi
     41 unset CASE_SENSITIVE HYPHEN_INSENSITIVE
     42 
     43 # Complete . and .. special directories
     44 zstyle ':completion:*' special-dirs true
     45 
     46 zstyle ':completion:*' list-colors ''
     47 zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#) ([0-9a-z-]#)*=01;34=0=01'
     48 
     49 zstyle ':completion:*:*:*:*:processes' command "ps -u $USER -o pid,user,comm -w -w"
     50 
     51 # disable named-directories autocompletion
     52 zstyle ':completion:*:cd:*' tag-order local-directories directory-stack path-directories
     53 
     54 # Use caching so that commands like apt and dpkg complete are useable
     55 zstyle ':completion::complete:*' use-cache 1
     56 zstyle ':completion::complete:*' cache-path $ZSH_CACHE_DIR
     57 
     58 # Don't complete uninteresting users
     59 zstyle ':completion:*:*:*:users' ignored-patterns \
     60         adm amanda apache at avahi avahi-autoipd beaglidx bin cacti canna \
     61         clamav daemon dbus distcache dnsmasq dovecot fax ftp games gdm \
     62         gkrellmd gopher hacluster haldaemon halt hsqldb ident junkbust kdm \
     63         ldap lp mail mailman mailnull man messagebus  mldonkey mysql nagios \
     64         named netdump news nfsnobody nobody nscd ntp nut nx obsrun openvpn \
     65         operator pcap polkitd postfix postgres privoxy pulse pvm quagga radvd \
     66         rpc rpcuser rpm rtkit scard shutdown squid sshd statd svn sync tftp \
     67         usbmux uucp vcsa wwwrun xfs '_*'
     68 
     69 # ... unless we really want to.
     70 zstyle '*' single-ignored show
     71 
     72 if [[ $COMPLETION_WAITING_DOTS = true ]]; then
     73   expand-or-complete-with-dots() {
     74     # toggle line-wrapping off and back on again
     75     [[ -n "$terminfo[rmam]" && -n "$terminfo[smam]" ]] && echoti rmam
     76     print -Pn "%{%F{red}......%f%}"
     77     [[ -n "$terminfo[rmam]" && -n "$terminfo[smam]" ]] && echoti smam
     78 
     79     zle expand-or-complete
     80     zle redisplay
     81   }
     82   zle -N expand-or-complete-with-dots
     83   bindkey "^I" expand-or-complete-with-dots
     84 fi
     85