summaryrefslogtreecommitdiffstats
path: root/.zsh/rc/70completion
diff options
context:
space:
mode:
Diffstat (limited to '.zsh/rc/70completion')
-rw-r--r--.zsh/rc/70completion/10misc49
-rw-r--r--.zsh/rc/70completion/10own_functions14
2 files changed, 63 insertions, 0 deletions
diff --git a/.zsh/rc/70completion/10misc b/.zsh/rc/70completion/10misc
new file mode 100644
index 0000000..e0fdffe
--- /dev/null
+++ b/.zsh/rc/70completion/10misc
@@ -0,0 +1,49 @@
+#--------------------
+# Completion stuff
+#--------------------
+autoload -Uz compinit
+compinit
+
+# correct 7etc/foo to /etc/foo
+# if anyone has a working solution for /etc7foo please contact me
+function _7slash {
+ if [[ $words[CURRENT] = 7(#b)(*)(#e) ]]
+ then
+ compadd -U -X 'Correct leading 7 to /' -f /$match[1]
+ fi
+}
+
+zstyle :compinstall filename '$HOME/.zshrc'
+
+# cache results because yaourt is slow
+zstyle ':completion:*' use-cache on
+zstyle ':completion:*' cache-path $HOME/.zsh/cache
+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)'
+
+# ignore completion for commands we don't have
+zstyle ':completion:*:functions' ignored-patterns '_*'
+
+# show menu when tabbing
+zstyle ':completion:*' menu yes select
+zstyle ':completion:*' file-sort time
+
+# remove / after dirnames
+# e.g. ls foo/ -> ls foo
+#zstyle ':completion:*' squeeze-slashes true
+zstyle ':completion:*' squeeze-slashes false
+
+# if in foo/bar don't show bar when cd ../<TAB>
+zstyle ':completion:*:cd:*' ignore-parents parent pwd
+
+# ignore case when completing
+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'
diff --git a/.zsh/rc/70completion/10own_functions b/.zsh/rc/70completion/10own_functions
new file mode 100644
index 0000000..2be4e67
--- /dev/null
+++ b/.zsh/rc/70completion/10own_functions
@@ -0,0 +1,14 @@
+# complete my little rc function (archlinux startscripts)
+function _rc () {
+ case $CURRENT in
+ 2) compadd $(find /etc/rc.d/ -maxdepth 1 -type f -executable -printf '%f ');;
+ 3) compadd $(/etc/rc.d/$words[2] 2> /dev/null | grep -i usage | sed 's/.*{\(.*\)}/\1/' | sed 's/|/ /g');;
+ esac
+}
+compdef _rc rc
+
+# easier way to use sshfs ;)
+function _ssh-mount () {
+ compadd $(cat ${HOME}/bin/ssh-mount.sh | egrep "Servers:.*" | sed "s#echo \-e \"\${green}Servers\:\$NC##g; s#\"\;##g; s#,##g")
+}
+compdef _ssh-mount ssh-mount.sh \ No newline at end of file