completion.zsh 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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. # Case-insensitive completion.
  24. zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}' 'r:|[._-]=* r:|=*' 'l:|=* r:|=*'
  25. # Completion Waiting Dots
  26. expand-or-complete-with-dots() {
  27. # toggle line-wrapping off and back on again
  28. [[ -n "$terminfo[rmam]" && -n "$terminfo[smam]" ]] && echoti rmam
  29. print -Pn "%{$FG[1]......$cReset%}"
  30. [[ -n "$terminfo[rmam]" && -n "$terminfo[smam]" ]] && echoti smam
  31. zle expand-or-complete
  32. zle redisplay
  33. }
  34. zle -N expand-or-complete-with-dots
  35. bindkey "^I" expand-or-complete-with-dots