completion.zsh 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. # fixme - the load process here seems a bit bizarre
  2. unsetopt menu_complete # do not autoselect the first completion entry
  3. unsetopt flowcontrol
  4. setopt auto_menu # show completion menu on succesive tab press
  5. setopt complete_in_word
  6. setopt complete_aliases
  7. setopt always_to_end
  8. WORDCHARS=''
  9. zmodload -i zsh/complist
  10. ## case-insensitive (all),partial-word and then substring completion
  11. if [ "x$CASE_SENSITIVE" = "xtrue" ]; then
  12. zstyle ':completion:*' matcher-list 'r:|[._-]=* r:|=*' 'l:|=* r:|=*'
  13. unset CASE_SENSITIVE
  14. else
  15. zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}' 'r:|[._-]=* r:|=*' 'l:|=* r:|=*'
  16. fi
  17. zstyle ':completion:*' list-colors ''
  18. # should this be in keybindings?
  19. bindkey -M menuselect '^o' accept-and-infer-next-history
  20. zstyle ':completion:*:*:*:*:*' menu select
  21. zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#) ([0-9a-z-]#)*=01;34=0=01'
  22. zstyle ':completion:*:*:*:*:processes' command "ps -u `whoami` -o pid,user,comm -w -w"
  23. # disable named-directories autocompletion
  24. zstyle ':completion:*:cd:*' tag-order local-directories directory-stack path-directories
  25. cdpath=(.)
  26. # use /etc/hosts and known_hosts for hostname completion
  27. [ -r ~/.ssh/known_hosts ] && _ssh_hosts=(${${${${(f)"$(<$HOME/.ssh/known_hosts)"}:#[\|]*}%%\ *}%%,*}) || _ssh_hosts=()
  28. [ -r /etc/hosts ] && : ${(A)_etc_hosts:=${(s: :)${(ps:\t:)${${(f)~~"$(</etc/hosts)"}%%\#*}##[:blank:]#[^[:blank:]]#}}} || _etc_hosts=()
  29. hosts=(
  30. "$_ssh_hosts[@]"
  31. "$_etc_hosts[@]"
  32. `hostname`
  33. localhost
  34. )
  35. zstyle ':completion:*:hosts' hosts $hosts
  36. # Use caching so that commands like apt and dpkg complete are useable
  37. zstyle ':completion::complete:*' use-cache 1
  38. zstyle ':completion::complete:*' cache-path ~/.oh-my-zsh/cache/
  39. # Don't complete uninteresting users
  40. zstyle ':completion:*:*:*:users' ignored-patterns \
  41. adm amanda apache avahi beaglidx bin cacti canna clamav daemon \
  42. dbus distcache dovecot fax ftp games gdm gkrellmd gopher \
  43. hacluster haldaemon halt hsqldb ident junkbust ldap lp mail \
  44. mailman mailnull mldonkey mysql nagios \
  45. named netdump news nfsnobody nobody nscd ntp nut nx openvpn \
  46. operator pcap postfix postgres privoxy pulse pvm quagga radvd \
  47. rpc rpcuser rpm shutdown squid sshd sync uucp vcsa xfs
  48. # ... unless we really want to.
  49. zstyle '*' single-ignored show