Skip to content

Instantly share code, notes, and snippets.

@kechol
Created June 4, 2017 16:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kechol/8434779270c621c1565922175c43def4 to your computer and use it in GitHub Desktop.
Save kechol/8434779270c621c1565922175c43def4 to your computer and use it in GitHub Desktop.
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