Mercurial > dotfiles.old
diff zsh/completion.zsh @ 151:87498dbd779a
Move away from oh-my-zsh
author | zegervdv <zegervdv@me.com> |
---|---|
date | Mon, 20 Oct 2014 21:49:21 +0200 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/zsh/completion.zsh Mon Oct 20 21:49:21 2014 +0200 @@ -0,0 +1,74 @@ +# add in zsh-completions +fpath=(/usr/local/share/zsh-completions $fpath) + +autoload -U compinit && compinit +zmodload -i zsh/complist +# GRML style completion +# activate color-completion +zstyle ':completion:*:default' list-colors ${(s.:.)LS_COLORS} + +# format on completion +zstyle ':completion:*:descriptions' format $'%{\e[0;31m%}completing %B%d%b%{\e[0m%}' + +# automatically complete 'cd -<tab>' and 'cd -<ctrl-d>' with menu +# zstyle ':completion:*:*:cd:*:directory-stack' menu yes select + +# insert all expansions for expand completer +zstyle ':completion:*:expand:*' tag-order all-expansions +zstyle ':completion:*:history-words' list false + +# activate menu +zstyle ':completion:*:history-words' menu yes + +# ignore duplicate entries +zstyle ':completion:*:history-words' remove-all-dups yes +zstyle ':completion:*:history-words' stop yes + +# match uppercase from lowercase +zstyle ':completion:*' matcher-list 'm:{a-z}={A-Z}' + +zstyle ':completion:*:matches' group 'yes' +zstyle ':completion:*' group-name '' +if [[ "$NOMENU" -eq 0 ]] ; then + # if there are more than 5 options allow selecting from a menu + zstyle ':completion:*' menu select=5 +else + # don't use any menus at all + setopt no_auto_menu +fi + +zstyle ':completion:*:messages' format '%d' +zstyle ':completion:*:options' auto-description '%d' + +# describe options in full +zstyle ':completion:*:options' description 'yes' + +# complete manual by their section +zstyle ':completion:*:manuals' separate-sections true +zstyle ':completion:*:manuals.*' insert-sections true +zstyle ':completion:*:man:*' menu yes select + +# Search path for sudo completion +zstyle ':completion:*:sudo:*' command-path /usr/local/sbin \ + /usr/local/bin \ + /usr/sbin \ + /usr/bin \ + /sbin \ + /bin \ + /usr/X11R6/bin + +# provide .. as a completion +zstyle ':completion:*' specal-dirs .. + + +zstyle ':completion::*:(m|)vim:*' ignored-patterns '*.(o|hex|elf|pyc|pdf|out|aux|toc|out|fls|bbl|synctex.gz|dvi|blg|fdb_latexmk)' + +# ag tab complete +_ag() { + if (( CURRENT == 2 )); then + compadd $(cut -f 1 .git/tags tmp/tags 2>/dev/null | grep -v '!_TAG') + fi +} + +compdef _ag ag +