From 8812f7e42272f7f5db4bd24418f48a0c17741237 Mon Sep 17 00:00:00 2001 From: Bodaniel Jeanes Date: Tue, 29 Jun 2010 21:40:15 +1000 Subject: [PATCH] Clean up ZSH completions and group matches intelligently --- zsh/completions | 41 +++++++++++++++++++++++++++++++++++++++++ zsh/config | 24 ------------------------ zsh/zshrc | 3 +++ 3 files changed, 44 insertions(+), 24 deletions(-) create mode 100644 zsh/completions diff --git a/zsh/completions b/zsh/completions new file mode 100644 index 0000000..94139b3 --- /dev/null +++ b/zsh/completions @@ -0,0 +1,41 @@ +# +# completion tweaking +# +autoload -U compinit; compinit + +# Group matches and describe groups +zstyle ':completion:*:matches' group 'yes' +zstyle ':completion:*:descriptions' format $'\e[01;33m -- %d --\e[0m' +zstyle ':completion::complete:cd:' tag-order local-directories path-directories +zstyle ':completion:*' group-name '' + + + + + + + +# zstyle ':completion:*:options' description 'yes' +# zstyle ':completion:*:options' auto-description '%d' +# zstyle ':completion:*:messages' format $'\e[01;35m -- %d --\e[0m' +# zstyle ':completion:*:warnings' format $'\e[01;31m -- No Matches Found --\e[0m' + +# zstyle ':completion:*' verbose yes +# zstyle ':completion:*' use-cache on +# zstyle ':completion:*' users resolve +# hosts=(${${${${(f)"$(<$HOME/.ssh/known_hosts)"}:#[0-9]*}%%\ *}%%,*}) +# zstyle ':completion:*:hosts' hosts $hosts +# zstyle ':completion::complete:cd:' tag-order local-directories path-directories + +# # use dircolours in completion listings +# zstyle ':completion:*' list-colors ${(s.:.)LSCOLORS} +# +# # allow approximate matching +# zstyle ':completion:*' completer _complete _match _approximate +# zstyle ':completion:*:match:*' original only +# zstyle ':completion:*:approximate:*' max-errors 1 numeric +# zstyle ':completion:*' auto-description 'Specify: %d' +# zstyle ':completion:*' verbose true +# zstyle ':completion:*:functions' ignored-patterns '_*' +# zstyle ':completion:*:*:(^rm):*:*files' ignored-patterns \ +# '*?.(o|c~|zwc)' '*?~' diff --git a/zsh/config b/zsh/config index 11bdb90..68f9f54 100644 --- a/zsh/config +++ b/zsh/config @@ -29,27 +29,3 @@ setopt recexact # recognise exact, ambiguous matches # for kill-word, etc. export WORDCHARS='' -# -# completion tweaking -# - -# complete hostnames out of ssh's ~/.ssh/known_hosts -autoload -U compinit; compinit -zstyle ':completion:*' use-cache on -zstyle ':completion:*' users resolve -hosts=(${${${${(f)"$(<$HOME/.ssh/known_hosts)"}:#[0-9]*}%%\ *}%%,*}) -zstyle ':completion:*:hosts' hosts $hosts - -# use dircolours in completion listings -zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS} - -# allow approximate matching -zstyle ':completion:*' completer _complete _match _approximate -zstyle ':completion:*:match:*' original only -zstyle ':completion:*:approximate:*' max-errors 1 numeric -zstyle ':completion:*' auto-description 'Specify: %d' -zstyle ':completion:*' format 'Completing %d' -zstyle ':completion:*' verbose true -zstyle ':completion:*:functions' ignored-patterns '_*' -zstyle ':completion:*:*:(^rm):*:*files' ignored-patterns \ - '*?.(o|c~|zwc)' '*?~' diff --git a/zsh/zshrc b/zsh/zshrc index 35fd65e..e2e9224 100644 --- a/zsh/zshrc +++ b/zsh/zshrc @@ -10,6 +10,9 @@ source $DOT_FILES/zsh/oh-my-zsh # Extra ZSH configuration source $DOT_FILES/zsh/config +# Rake completion +source $DOT_FILES/zsh/completions + # My custom theme source $DOT_FILES/zsh/theme