[zsh] Add neat little Alt-C ssh picker and source tmux from source
This commit is contained in:
parent
04fe44859e
commit
9111dc0252
18
home/.zshrc
18
home/.zshrc
|
@ -10,7 +10,6 @@ source ~/.zplug/init.zsh
|
||||||
source $ZSH/oh-my-zsh.sh
|
source $ZSH/oh-my-zsh.sh
|
||||||
|
|
||||||
zplug "plugins/fasd", from:oh-my-zsh
|
zplug "plugins/fasd", from:oh-my-zsh
|
||||||
zplug "plugins/tmux", from:oh-my-zsh
|
|
||||||
zplug "plugins/tmuxinator", from:oh-my-zsh
|
zplug "plugins/tmuxinator", from:oh-my-zsh
|
||||||
zplug "denysdovhan/spaceship-prompt", use:spaceship.zsh, from:github, as:theme
|
zplug "denysdovhan/spaceship-prompt", use:spaceship.zsh, from:github, as:theme
|
||||||
zplug "junegunn/fzf", use:shell/key-bindings.zsh
|
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"
|
ln -sf "$SSH_AUTH_SOCK" "$SSH_TMUX_SOCK"
|
||||||
fi
|
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
|
# Work around a broken autocompletion https://github.com/gopasspw/gopass/issues/585
|
||||||
source <(gopass completion zsh | head -n -1 | tail -n +2)
|
source <(gopass completion zsh | head -n -1 | tail -n +2)
|
||||||
compdef _gopass gopass
|
compdef _gopass gopass
|
||||||
|
|
Loading…
Reference in New Issue