Last active
December 7, 2018 12:46
-
-
Save micheam/20ddae8d35c4dc3af6aa1afb506f2577 to your computer and use it in GitHub Desktop.
Select local repository efficiently with `ghq` and `fzf`.
This file contains hidden or 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
# 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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
looks like this :)
