summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.zshrc19
1 files changed, 19 insertions, 0 deletions
diff --git a/.zshrc b/.zshrc
index ac97d9b..ab08cc3 100644
--- a/.zshrc
+++ b/.zshrc
@@ -265,11 +265,29 @@ fzf-file-widget() {
return $ret
}
+__fhost() {
+ printf "%s\n" $hosts | FZF_DEFAULT_OPTS="--height ${FZF_TMUX_HEIGHT:-40%} --reverse $FZF_DEFAULT_OPTS $FZF_CTRL_T_OPTS" $(__fzfcmd) -m "$@" | while read item; do
+ echo -n "${(q)item} "
+ done
+ local ret=$?
+ echo
+ return $ret
+}
+
+fzf-hosts-widget() {
+ LBUFFER="${LBUFFER}$(__fhost)"
+ local ret=$?
+ zle reset-prompt
+ return $ret
+}
+
if type fzf &>/dev/null; then
zle -N fzf-history-widget
bindkey '^R' fzf-history-widget
zle -N fzf-file-widget
bindkey '^T' fzf-file-widget
+ zle -N fzf-hosts-widget
+ bindkey '^H' fzf-hosts-widget
fi
# }}}
@@ -709,6 +727,7 @@ hosts=(
$_ssh_config_hosts[@]
localhost
)
+hosts=(${(u)hosts[@]})
zstyle ':completion:*:hosts' hosts $hosts
# automagic url quoter