Last active
December 13, 2016 20:55
-
-
Save lleveque/d915f491baff7e5fa45e206b9b3e61c0 to your computer and use it in GitHub Desktop.
When in your $GOPATH, make `go` autocomplete to packages. Add this to your .bashrc.
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
function _gocomplete_() | |
{ | |
# What do we want to autocomplete ? | |
local word=${COMP_WORDS[COMP_CWORD]} | |
# list packages that match in src/ subfolder, discarding warnings if no result | |
COMPREPLY=($(go list ./src/"${word}"... 2>/dev/null)) | |
} | |
# register autocomplete function for `go` | |
complete -F _gocomplete_ go |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment