summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorian Pritz <bluewind@server-speed.net>2011-02-16 21:28:24 +0100
committerFlorian Pritz <bluewind@server-speed.net>2011-02-16 21:28:24 +0100
commit55c346d932d714573764acd7e388d0c864492798 (patch)
treeb4f02633addf5225225c9c395325cbd9392a5b47
parentde4f957f3396eb19e038e24a4cbdb7a3bd6ec938 (diff)
downloaddotfiles-55c346d932d714573764acd7e388d0c864492798.tar.gz
dotfiles-55c346d932d714573764acd7e388d0c864492798.tar.xz
.zshrc: multiple compsys changes
Credits: http://ft.bewatermyfriend.org/comp/zsh/zshrc.d/compsys.html Signed-off-by: Florian Pritz <bluewind@server-speed.net>
-rw-r--r--.zshrc56
1 files changed, 47 insertions, 9 deletions
diff --git a/.zshrc b/.zshrc
index 76f142e..31957de 100644
--- a/.zshrc
+++ b/.zshrc
@@ -680,19 +680,20 @@ function _7slash {
zstyle :compinstall filename '$HOME/.zshrc'
-# cache results because yaourt is slow
+# performance tweaks
zstyle ':completion:*' use-cache on
zstyle ':completion:*' cache-path $HOME/.zsh/cache
+zstyle ':completion:*' use-perl on
# completion colours
-zstyle ':completion:*' list-colors "${LS_COLORS}"
+zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS}
zstyle ':completion:*' completer _complete _match _approximate _7slash
zstyle ':completion:*:match:*' original only
# allow more mistypes if longer command
-zstyle -e ':completion:*:approximate:*' \
- max-errors 'reply=($((($#PREFIX+$#SUFFIX)/3))numeric)'
+#zstyle -e ':completion:*:approximate:*' \
+# max-errors 'reply=($((($#PREFIX+$#SUFFIX)/3))numeric)'
# ignore completion for commands we don't have
zstyle ':completion:*:functions' ignored-patterns '_*'
@@ -701,15 +702,15 @@ zstyle ':completion:*:functions' ignored-patterns '_*'
zstyle ':completion:*' menu yes select
# better completion for kill
-zstyle ':completion:*:*:kill:*' command 'ps -u$USER -o pid,%cpu,tty,cputime,cmd'
+zstyle ':completion:*:*:kill:*' command 'ps --forest -u$USER -o pid,%cpu,tty,cputime,cmd'
# Provide more processes in completion of programs like killall:
zstyle ':completion:*:processes-names' command 'ps c -u ${USER} -o command | uniq'
compdef pkill=killall
# bugged with zsh 4.3.10 for whatever reason
-#zstyle ':completion:*' file-sort time
-zstyle ':completion:*' file-sort name
+zstyle ':completion:*' file-sort time
+#zstyle ':completion:*' file-sort name
# Ignore same file on rm
zstyle ':completion:*:(rm|kill|diff):*' ignore-line yes
@@ -748,8 +749,45 @@ zstyle ':completion:*:cd:*' ignored-patterns '(*/)#lost+found'
zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}' 'r:|[._-]=* r:|=*' 'l:|=* r:|=*'
# make some stuff look better
-zstyle ':completion:*:descriptions' format $'%{\e[0;31m%}completing %B%d%b%{\e[0m%}'
-zstyle ':completion:*:warnings' format $'%{\e[0;31m%}No matches for:%{\e[0m%} %d'
+# from: http://ft.bewatermyfriend.org/comp/zsh/zshrc.d/compsys.html
+zstyle ':completion:*:descriptions' format "- %{${fg[yellow]}%}%d%{${reset_color}%} -"
+zstyle ':completion:*:messages' format "- %{${fg[cyan]}%}%d%{${reset_color}%} -"
+zstyle ':completion:*:corrections' format "- %{${fg[yellow]}%}%d%{${reset_color}%} - (%{${fg[cyan]}%}errors %e%{${reset_color}%})"
+zstyle ':completion:*:default' \
+ select-prompt \
+ "%{${fg[yellow]}%}Match %{${fg_bold[cyan]}%}%m%{${fg_no_bold[yellow]}%} Line %{${fg_bold[cyan]}%}%l%{${fg_no_bold[red]}%} %p%{${reset_color}%}"
+zstyle ':completion:*:default' \
+ list-prompt \
+ "%{${fg[yellow]}%}Line %{${fg_bold[cyan]}%}%l%{${fg_no_bold[yellow]}%} Continue?%{${reset_color}%}"
+zstyle ':completion:*:warnings' \
+ format \
+ "- %{${fg_no_bold[red]}%}no match%{${reset_color}%} - %{${fg_no_bold[yellow]}%}%d%{${reset_color}%}"
+zstyle ':completion:*' group-name ''
+
+# manual pages are sorted into sections
+# from: http://ft.bewatermyfriend.org/comp/zsh/zshrc.d/compsys.html
+zstyle ':completion:*:manuals' separate-sections true
+zstyle ':completion:*:manuals.(^1*)' insert-sections true
+
+### highlight the original input.
+ zstyle ':completion:*:original' \
+ list-colors "=*=$color[red];$color[bold]"
+
+### highlight words like 'esac' or 'end'
+ zstyle ':completion:*:reserved-words' \
+ list-colors "=*=$color[red]"
+
+### colorize hostname completion
+ zstyle ':completion:*:*:*:*:hosts' \
+ list-colors "=*=$color[cyan];$color[bg-black]"
+
+### colorize username completion
+ zstyle ':completion:*:*:*:*:users' \
+ list-colors "=*=$color[red];$color[bg-black]"
+
+### colorize processlist for 'kill'
+ zstyle ':completion:*:*:kill:*:processes' \
+ list-colors "=(#b) #([0-9]#) #([^ ]#)*=$color[none]=$color[yellow]=$color[green]"
# complete my little rc function (archlinux startscripts)
function _rc () {