[zsh] Fixup the Alt-v vm starter command
This commit is contained in:
parent
095b2a56c2
commit
a0ce3c5e30
10
home/.zshrc
10
home/.zshrc
|
@ -86,10 +86,14 @@ zle -N fzf-ssh
|
||||||
bindkey '\es' fzf-ssh
|
bindkey '\es' fzf-ssh
|
||||||
|
|
||||||
function fzf-vm () {
|
function fzf-vm () {
|
||||||
local selected_vm=$(grep "Host " ~/.ssh/config | grep -oP "vm-(\w+)" | sort -u | cut -b 4-)
|
local selected_vm=$(grep "Host " ~/.ssh/config | grep -oP "vm-(\w+)" | sort -u | cut -b 4- | fzf --reverse --height=20 --query "$LBUFFER")
|
||||||
vm $selected_vm
|
if [ -n "$selected_vm" ]; then
|
||||||
|
BUFFER="vm ${selected_vm} ''"
|
||||||
|
zle accept-line
|
||||||
|
fi
|
||||||
|
zle reset-prompt
|
||||||
}
|
}
|
||||||
zle -N fzf-ssh
|
zle -N fzf-vm
|
||||||
bindkey '\ev' fzf-vm
|
bindkey '\ev' fzf-vm
|
||||||
|
|
||||||
# Via @leahneukirchen
|
# Via @leahneukirchen
|
||||||
|
|
Loading…
Reference in New Issue