completion.zsh 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. # Relevant manpages:
  2. # - zshoptions
  3. # - zshcompwid
  4. # - zshcompsys
  5. setopt auto_menu # show completion menu on succesive tab press
  6. setopt complete_in_word # Perform completion from both ends of a word
  7. setopt always_to_end # Move cursor to end of word after completion
  8. # Add custom completions from dotfiles to fpath.
  9. fpath=(~/dotfiles/shell/zsh/completions $fpath)
  10. # Load completion functions
  11. #
  12. # `compinit` - Completion initisation.
  13. # `compaudit` - Finds insecure completion folders (wrong owner, 777) in fpath.
  14. # Used by compinit internally, added here to be called manually.
  15. # `compinstall` - Completion configurator.
  16. autoload -Uz compinit compaudit #compinstall
  17. # Initialise completion
  18. compinit
  19. # Load zsh module for completion listing extensions.
  20. # Enables extensions for match highlighting, list scrolling and different
  21. # completion menu styles.
  22. zmodload -i zsh/complist
  23. #?
  24. WORDCHARS=''
  25. # Case-insensitive completion.
  26. zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}' 'r:|[._-]=* r:|=*' 'l:|=* r:|=*'
  27. # Completion Waiting Dots
  28. expand-or-complete-with-dots() {
  29. # toggle line-wrapping off and back on again
  30. [[ -n "$terminfo[rmam]" && -n "$terminfo[smam]" ]] && echoti rmam
  31. print -Pn "%{$FG[1]......$cReset%}"
  32. [[ -n "$terminfo[rmam]" && -n "$terminfo[smam]" ]] && echoti smam
  33. zle expand-or-complete
  34. zle redisplay
  35. }
  36. zle -N expand-or-complete-with-dots
  37. bindkey "^I" expand-or-complete-with-dots