1
0

completion.zsh 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. # make autocompletion faster by caching
  2. autoload -Uz compinit
  3. compinit -d "$HOME/.zsh/cache/zcompdump"
  4. zstyle ':completion:*' use-cache on
  5. zstyle ':completion:*' cache-path $HOME/.zsh/cache
  6. # use menu
  7. zstyle ':completion:*' menu select
  8. # enable approximate autocompletion
  9. zstyle ':completion:*' completer _complete _match _approximate
  10. zstyle ':completion:*:match:*' original only
  11. # zstyle ':completion:*:approximate:*' max-errors 1 numeric
  12. # zstyle -e ':completion:*:approximate:*' max-errors 'reply=($((($#PREFIX+$#SUFFIX)/3)) numeric)'
  13. # Smart matching of dashed values, e.g. f-b matching foo-bar
  14. zstyle ':completion:*' matcher-list 'r:|[._-]=* r:|=*'
  15. # Group results by category
  16. zstyle ':completion:*' group-name ''
  17. # Keep directories and files separated
  18. zstyle ':completion:*' list-dirs-first true
  19. # Don't try parent path completion if the directories exist
  20. zstyle ':completion:*' accept-exact-dirs true
  21. zstyle ':completion:*' squeeze-slashes true
  22. # Always use menu selection for `cd -`
  23. zstyle ':completion:*:*:cd:*:directory-stack' force-list always
  24. zstyle ':completion:*:*:cd:*:directory-stack' menu yes select
  25. # ignore completion functions for commands you don't have
  26. zstyle ':completion:*:functions' ignored-patterns '(_*|pre(cmd|exec)|TRAP*)'
  27. # Prettier completion for processes
  28. zstyle ':completion:*:*:*:*:processes' force-list always
  29. zstyle ':completion:*:*:*:*:processes' menu yes select
  30. zstyle ':completion:*:*:*:*:processes' list-colors '=(#b) #([0-9]#) ([0-9a-z-]#)*=01;34=0=01'
  31. zstyle ':completion:*:*:*:*:processes' command "ps -u $USER -o pid,user,args -w -w"
  32. zstyle ':filter-select:highlight' matched fg=red
  33. zstyle ':filter-select' max-lines 10
  34. zstyle ':filter-select' rotate-list yes
  35. zstyle ':filter-select' case-insensitive yes # enable case-insensitive search
  36. # Use ls-colors for path completions
  37. function _set-list-colors() {
  38. zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS}
  39. unfunction _set-list-colors
  40. }
  41. sched 0 _set-list-colors # deferred since LC_COLORS might not be available yet