Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
function __ssh_peco_ctrl_s -d 'Select hosts from ssh config'
grep 'Host ' ~/.ssh/config | awk '{print $2}' | peco | read host
[ -n "$host" ]; and ssh $host
commandline -f repaint
end
function __git_branch_peco_ctrl_b -d 'Select branch and checkout'
git branch | awk '{print $2}' | peco | read branch
[ -n "$branch" ]; and git checkout $branch
commandline -f repaint
end
function fish_user_key_bindings
bind \cs '__ssh_peco_ctrl_s'
bind \cb '__git_branch_peco_ctrl_b'
if bind -M insert >/dev/null ^/dev/null
bind -M insert \cs '__ssh_peco_ctrl_s'
bind -M insert \cb '__git_branch_peco_ctrl_b'
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment