Advertisement
metalx1000

ZSH Auto complete notes

Sep 21st, 2018
906
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.77 KB | None | 0 0
  1. #zsh autocompletion
  2. #more info at https://askql.wordpress.com/2011/01/11/zsh-writing-own-completion/
  3. #list all paths that completion files are found
  4. echo $fpath
  5.  
  6. #create your own completion folder
  7. mkdir -p ~/.zsh/completion
  8.  
  9. #####add to ~/.zshrc or ~/.zshrc.local#####
  10. # COMPLETION SETTINGS
  11. # add custom completion scripts
  12. fpath=(~/.zsh/completion $fpath)
  13.  
  14. # compsys initialization
  15. autoload -U compinit
  16. compinit
  17.  
  18. # show completion menu when number of options is at least 2
  19. zstyle ':completion:*' menu select=2
  20. ###############END RC file################
  21.  
  22. #Created completion file (must start with _)
  23. vim ~/.zsh/completion/_hello
  24. #compdef hello
  25. _arguments "1: :(World People)"
  26.  
  27. #restart shell, type 'hello' and press tab.
  28. #World and People should now be options
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement