Last active
March 26, 2016 20:56
-
-
Save pbkhrv/7e637bee1c542db8ff88 to your computer and use it in GitHub Desktop.
ghi + fzf autocomplete
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
# ghi is a GitHub issues CLI https://github.com/stephencelis/ghi | |
# fzf is "A command-line fuzzy finder" https://github.com/junegunn/fzf | |
# Usage: | |
# Image you need to comment on an issue but you dont remember its number. | |
# Instead of searching for the number first and then typing "ghi edit <number>", | |
# use the fzf fuzzy complete function: | |
# | |
# ghi comment **<TAB> | |
# | |
# That will bring up the list of issues for the current project in fzf, allowing you to fuzzy-search it. | |
# as soon as you press <ENTER>, it'll output the issue number, thus completing the "ghi comment <number>" command | |
# Based on https://github.com/junegunn/fzf/wiki/Examples-%28completion%29 | |
# Add the following to your zsh or bash profile AFTER the .fzf.sh is loaded | |
_fzf_complete_ghi() { | |
_fzf_complete "+m" "$@" < <( | |
ghi --no-pager list -P | |
) | |
} | |
_fzf_complete_ghi_post() { | |
awk '{ print $1 }' | |
} | |
[ -n "$BASH" ] && complete -F _fzf_complete_ghi -o default -o bashdefault ghi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment