Skip to content

Instantly share code, notes, and snippets.

@micheam
Last active December 7, 2018 12:46
Show Gist options
  • Save micheam/20ddae8d35c4dc3af6aa1afb506f2577 to your computer and use it in GitHub Desktop.
Save micheam/20ddae8d35c4dc3af6aa1afb506f2577 to your computer and use it in GitHub Desktop.
Select local repository efficiently with `ghq` and `fzf`.
# append this into your .bashrc
export FZF_DEFAULT_OPTS='--layout=reverse --border --multi --ansi --exit-0'
function ghq-list-then-look
{
local selected=$(ghq list -p \
| fzf --height 90% --preview='find {} -depth 1 -type f | grep -i -e "readme.[(md)|(mkd)|(markdown)]" | head -1 | xargs head -$LINES')
if [ -n "${selected}" ]; then
clear
cd "${selected}"
fi
}
alias ghqlook=ghq-list-then-look
# Powered by
# * fzf - command-line fuzzy finder | https://github.com/motemen/ghq
# * ghq - Manage remote repository clones | https://github.com/junegunn/fzf
@micheam
Copy link
Author

micheam commented Dec 7, 2018

looks like this :)
1 shell 2018-12-07 21-22-37

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment