summaryrefslogtreecommitdiff
path: root/lib/completion.zsh
diff options
context:
space:
mode:
Diffstat (limited to 'lib/completion.zsh')
-rw-r--r--lib/completion.zsh15
1 files changed, 13 insertions, 2 deletions
diff --git a/lib/completion.zsh b/lib/completion.zsh
index fdd0a8536..f31e101d5 100644
--- a/lib/completion.zsh
+++ b/lib/completion.zsh
@@ -32,19 +32,21 @@ zstyle ':completion:*:cd:*' tag-order local-directories directory-stack path-dir
cdpath=(.)
# use /etc/hosts and known_hosts for hostname completion
+[ -r /etc/ssh/ssh_known_hosts ] && _global_ssh_hosts=(${${${${(f)"$(</etc/ssh/ssh_known_hosts)"}:#[\|]*}%%\ *}%%,*}) || _ssh_hosts=()
[ -r ~/.ssh/known_hosts ] && _ssh_hosts=(${${${${(f)"$(<$HOME/.ssh/known_hosts)"}:#[\|]*}%%\ *}%%,*}) || _ssh_hosts=()
[ -r /etc/hosts ] && : ${(A)_etc_hosts:=${(s: :)${(ps:\t:)${${(f)~~"$(</etc/hosts)"}%%\#*}##[:blank:]#[^[:blank:]]#}}} || _etc_hosts=()
hosts=(
+ "$_global_ssh_hosts[@]"
"$_ssh_hosts[@]"
"$_etc_hosts[@]"
- `hostname`
+ "$HOST"
localhost
)
zstyle ':completion:*:hosts' hosts $hosts
# Use caching so that commands like apt and dpkg complete are useable
zstyle ':completion::complete:*' use-cache 1
-zstyle ':completion::complete:*' cache-path ~/.oh-my-zsh/cache/
+zstyle ':completion::complete:*' cache-path $ZSH/cache/
# Don't complete uninteresting users
zstyle ':completion:*:*:*:users' ignored-patterns \
@@ -59,3 +61,12 @@ zstyle ':completion:*:*:*:users' ignored-patterns \
# ... unless we really want to.
zstyle '*' single-ignored show
+if [ "x$COMPLETION_WAITING_DOTS" = "xtrue" ]; then
+ expand-or-complete-with-dots() {
+ echo -n "\e[31m......\e[0m"
+ zle expand-or-complete
+ zle redisplay
+ }
+ zle -N expand-or-complete-with-dots
+ bindkey "^I" expand-or-complete-with-dots
+fi