Last active
January 28, 2020 09:09
-
-
Save dohq/a643084df0c1957b6990ee69fb3126a1 to your computer and use it in GitHub Desktop.
fzf-ghq
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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