completion.zsh 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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 always_to_end
  7. WORDCHARS=''
  8. zmodload -i zsh/complist
  9. ## case-insensitive (all),partial-word and then substring completion
  10. if [ "x$CASE_SENSITIVE" = "xtrue" ]; then
  11. zstyle ':completion:*' matcher-list 'r:|[._-]=* r:|=*' 'l:|=* r:|=*'
  12. unset CASE_SENSITIVE
  13. else
  14. zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}' 'r:|[._-]=* r:|=*' 'l:|=* r:|=*'
  15. fi
  16. zstyle ':completion:*' list-colors ''
  17. # should this be in keybindings?
  18. bindkey -M menuselect '^o' accept-and-infer-next-history
  19. zstyle ':completion:*:*:*:*:*' menu select
  20. zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#) ([0-9a-z-]#)*=01;34=0=01'
  21. if [ "$OSTYPE[0,7]" = "solaris" ]
  22. then
  23. zstyle ':completion:*:*:*:*:processes' command "ps -u `whoami` -o pid,user,comm"
  24. else
  25. zstyle ':completion:*:*:*:*:processes' command "ps -u `whoami` -o pid,user,comm -w -w"
  26. fi
  27. # disable named-directories autocompletion
  28. zstyle ':completion:*:cd:*' tag-order local-directories directory-stack path-directories
  29. cdpath=(.)
  30. # Use caching so that commands like apt and dpkg complete are useable
  31. zstyle ':completion::complete:*' use-cache 1
  32. zstyle ':completion::complete:*' cache-path $ZSH/cache/
  33. # Don't complete uninteresting users
  34. zstyle ':completion:*:*:*:users' ignored-patterns \
  35. adm amanda apache at avahi avahi-autoipd beaglidx bin cacti canna \
  36. clamav daemon dbus distcache dnsmasq dovecot fax ftp games gdm \
  37. gkrellmd gopher hacluster haldaemon halt hsqldb ident junkbust kdm \
  38. ldap lp mail mailman mailnull man messagebus mldonkey mysql nagios \
  39. named netdump news nfsnobody nobody nscd ntp nut nx obsrun openvpn \
  40. operator pcap polkitd postfix postgres privoxy pulse pvm quagga radvd \
  41. rpc rpcuser rpm rtkit scard shutdown squid sshd statd svn sync tftp \
  42. usbmux uucp vcsa wwwrun xfs '_*'
  43. # ... unless we really want to.
  44. zstyle '*' single-ignored show
  45. if [ "x$COMPLETION_WAITING_DOTS" = "xtrue" ]; then
  46. expand-or-complete-with-dots() {
  47. echo -n "\e[31m......\e[0m"
  48. zle expand-or-complete
  49. zle redisplay
  50. }
  51. zle -N expand-or-complete-with-dots
  52. bindkey "^I" expand-or-complete-with-dots
  53. fi