zstyle ':completion:*' add-space true zstyle ':completion:*' completer _expand _complete _match _prefix _approximate _list zstyle ':completion:*' menu select=1 zstyle ':completion:*' file-sort name zstyle ':completion:*' list-colots ${(s.:.)ZLS_COLORS} zstyle ':completion:*' menu select zstyle ':completion:*:approximate:*' max-errors 'reply=( $(( ($#PREFIX+$#SUFFIX)/3 )) numeric )' # {{{ Formats zstyle ':completion:*' group 1 zstyle ':completion:*' format '%B---- %d%b' zstyle ':completion:*:corrections' format '%B---- %d (errors %e)%b' zstyle ':completion:*:descriptions' format '%B---- %d%b' zstyle ':completion:*:messages' format '%B%U---- d%u%b' zstyle ':completion:*:warnings' format "%B$fg[red]%}---- no match for: $fg[white]%d%b" zstyle ':completion:*' group-name '' # }}} # {{{ Kill zstyle ':completion:*:processes' command 'ps -au$USER -o pid,time,cmd | grep -v "ps -au$USER -o pid,time,cmd"' zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#)[ 0-9:]##([^ ]#)*=01;30=01;31=01;38' # }}} # {{{ Host and users hosts=($( ( \ ( [ -r ~/.ssh/config ] && awk '/^host +[a-z]/ { print $2 }' ~/.ssh/config) ; \ ( [ -r ~/.ssh/known_hosts ] && awk '{print $1}' ~/.ssh/known_hosts | tr , '\n') \ ) | sort -u)) zstyle ':completion:*' hosts $hosts zstyle ':completion:*:hosts' list-colors '=(#b)(*)(bobov.name)=01;30=01;31' '=[^.]#=01;31' users=(root dexter anton) zstyle ':completion:*' users $users # }}} # Ignore for vim zstyle ':completion:*:*:vi(m|):*:*files' ignored-patterns '*?.(aux|dvi|ps|pdf|bbl|toc|lot|lof|o|cm?|class|py[oc])' # Ledger completion like hledger compdef ledger=hledger # Completing generic gnu commands # https://github.com/zsh-users/zsh-completions/blob/master/zsh-completions-howto.org compdef _gnu_generic lshw duplicity compdef _gnu_generic -p 'pg_*' # youtube-dl [[ -f /etc/bash_completion.d/youtube-dl.bash-completion ]] && source /etc/bash_completion.d/youtube-dl.bash-completion # vim: et ft=zsh fdm=marker :