Update bash host completion for ssh and telnet commands

This commit is contained in:
Junegunn Choi 2013-12-20 11:18:28 +09:00
parent 5483e41b2a
commit 636c86cf6f

View File

@ -100,7 +100,7 @@ _fzf_host_completion() {
local cur prev selected local cur prev selected
cur="${COMP_WORDS[COMP_CWORD]}" cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}" prev="${COMP_WORDS[COMP_CWORD-1]}"
[ "$cur" = '-l' -o "$prev" = '-l' ] && return 1 [[ "$cur" =~ ^- || "$prev" =~ ^- ]] && return 1
tput sc tput sc
selected=$(grep -v '^\s*\(#\|$\)' /etc/hosts | awk '{print $2}' | sort -u | fzf $FZF_COMPLETION_OPTS -q "$cur") selected=$(grep -v '^\s*\(#\|$\)' /etc/hosts | awk '{print $2}' | sort -u | fzf $FZF_COMPLETION_OPTS -q "$cur")