[zsh] Add neat little Alt-C ssh picker and source tmux from source

This commit is contained in:
Sebastian Schulze 2019-06-05 13:22:52 +02:00
parent 04fe44859e
commit 9111dc0252
Signed by: bascht
GPG Key ID: 5BCB1D3B4D38A35A
1 changed files with 17 additions and 1 deletions

View File

@ -10,7 +10,6 @@ source ~/.zplug/init.zsh
source $ZSH/oh-my-zsh.sh
zplug "plugins/fasd", from:oh-my-zsh
zplug "plugins/tmux", from:oh-my-zsh
zplug "plugins/tmuxinator", from:oh-my-zsh
zplug "denysdovhan/spaceship-prompt", use:spaceship.zsh, from:github, as:theme
zplug "junegunn/fzf", use:shell/key-bindings.zsh
@ -67,6 +66,23 @@ if [ "${SSH_AUTH_SOCK}" != "${SSH_TMUX_SOCK}" ]; then
ln -sf "$SSH_AUTH_SOCK" "$SSH_TMUX_SOCK"
fi
source /usr/share/zsh/site-functions/tmuxinator.zsh
# Via @dohq
# https://gist.github.com/dohq/1dc702cc0b46eb62884515ea52330d60
function fzf-ssh () {
local selected_host=$(grep "Host " ~/.ssh/config | grep -v '*' | cut -b 6- | fzf --query "$LBUFFER")
if [ -n "$selected_host" ]; then
BUFFER="ssh ${selected_host}"
zle accept-line
fi
zle reset-prompt
}
zle -N fzf-ssh
bindkey '\es' fzf-ssh
# Work around a broken autocompletion https://github.com/gopasspw/gopass/issues/585
source <(gopass completion zsh | head -n -1 | tail -n +2)
compdef _gopass gopass