From 6b21fbffb29bfaa8b938b970c70192234b78dac6 Mon Sep 17 00:00:00 2001 From: ndwarshuis Date: Wed, 1 Jun 2022 13:29:15 -0400 Subject: [PATCH] ENH use menu, pretty colors, and kinda better ssh options for completion --- dot_config/zsh/dot_zshrc.tmpl | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/dot_config/zsh/dot_zshrc.tmpl b/dot_config/zsh/dot_zshrc.tmpl index 774f235..3088781 100644 --- a/dot_config/zsh/dot_zshrc.tmpl +++ b/dot_config/zsh/dot_zshrc.tmpl @@ -8,16 +8,37 @@ bindkey -v '^?' backward-delete-char ## -------------------------------------------------- # autocompletion ## -------------------------------------------------- -# Highlight the current autocomplete option -zstyle ':completion:*' list-colors "${(s.:.)LS_COLORS}" +# load stuff (order matters) +zmodload zsh/complist autoload -Uz compinit && compinit -i autoload -Uz bashcompinit && bashcompinit +# use menu for selecting completion +bindkey -M menuselect 'h' vi-backward-char +bindkey -M menuselect 'k' vi-up-line-or-history +bindkey -M menuselect 'j' vi-down-line-or-history +bindkey -M menuselect 'l' vi-forward-char +zstyle ':completion:*' menu select + +# add nice colors for descriptions/warnings/messages +zstyle ':completion:*:*:*:*:descriptions' format '%F{green}-- %d --%f' +zstyle ':completion:*:messages' format ' %F{purple} -- %d --%f' +zstyle ':completion:*:warnings' format ' %F{red}-- no matches found --%f' + +# use sane grouping +zstyle ':completion:*' group-name '' + +# make file lists useful by showing relevant info +zstyle ':completion:*' file-list all + +# Highlight the current autocomplete option +zstyle ':completion:*' list-colors "${(s.:.)LS_COLORS}" + # ignore full hostnames in ssh config file # the default ssh function does not seem to differentiate b/t # HOST and HOSTNAME directives -zstyle ':completion:*:(ssh|scp|rsync|sshfs):*:hosts' ignored-patterns '*.yavin4.ch' +zstyle ':completion:*:(ssh|scp|rsync):*:hosts' ignored-patterns '*(.|:)*' loopback ip6-loopback localhost ip6-localhost broadcasthost ## -------------------------------------------------- # syntax highlighting a la fish