Import go package in vim
The vim golang official plugin comes with a handy macro to add a package import, at the top of the file:
:Import os
To import with a package alias:
:ImportAs {localname} {path}
And finally, to remove a package:
:Drop {package}
will add the "os" package inside the "import" block, at the right sorted position.
More info: http://golang.org/misc/vim/ftplugin/go/import.vim
Written by Philippe Lafoucrière
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Go
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#