Skip to content

Instantly share code, notes, and snippets.

@dohq
Last active January 28, 2020 09:09
Show Gist options
  • Save dohq/a643084df0c1957b6990ee69fb3126a1 to your computer and use it in GitHub Desktop.
Save dohq/a643084df0c1957b6990ee69fb3126a1 to your computer and use it in GitHub Desktop.
fzf-ghq
function fzf-ghq() {
local selected_dir=$(ghq list |fzf --prompt="Git Repos > " --preview "bat --color=always --style=header,grid --line-range :80 $(ghq root)/{}/README.*")
if [ -n "$selected_dir" ]; then
BUFFER="cd $(ghq root)/${selected_dir}"
zle accept-line
fi
zle reset-prompt
}
zle -N fzf-ghq
bindkey "^g" fzf-ghq
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment