This is a creation in Article, where the information may have evolved or changed.
The decision to discard the mouse starts, so be prepared to use VIM.
So how to build Golang environment in VIM?
With Git in vogue, it's so easy to build a vim environment.
And when Vim is built, it's basically no different from the IDE.
Highlighting, auto-completion, automatic formatting, viewing definition jumps, grammar detection, etc.
- Improved Syntax highlighting with items such as Functions, Operators, Methods.
- Auto Completion Support via
gocode
- Better on
gofmt
save, which keeps cursor position and doesn ' t break your undo history
- Go to Symbol/declaration with
:GoDef
- Look up documentation with
:GoDoc
inside Vim or open it in browser
- Automatically import packages via
:GoImport
or plug it into AutoSave
- Compile your package
:GoBuild
with, install it with :GoInstall
or test them with :GoTest
(also supports running single tests via )
- Quickly execute your current file/files with
:GoRun
- Automatic
GOPATH
detection based on the directory structure (i.e. projects gb
, godep
vendored projects)
- Change or display with
GOPATH
:GoPath
- Create a coverage profile and display annotated source code in browser to see which functions is covered with
:GoCoverage
- Call
gometalinter
:GoMetaLinter
with, which invokes all possible linters (Golint, vet, Errcheck, Deadcode, etc ...) and shows the warning S/errors
- Lint Your code with
:GoLint
- Run your code through to
:GoVet
catch static errors
- Advanced Source analysis tools utilizing Oracle, such as
:GoImplements
, :GoCallees
, and:GoReferrers
- Precise Type-safe renaming of identifiers with
:GoRename
- List all source files and dependencies
- Unchecked Error checking with
:GoErrCheck
- Integrated and improved snippets, supporting
ultisnips
orneosnippet
- Share your current code to play.golang.org with
:GoPlay
- On-the-fly type information about the word under the cursor. Plug it into your custom vim function.
- Go asm Formatting on save
- Tagbar support to show tags of the source code in a sidebar with
gotags
- Custom Vim text objects such as
a function
or inner function
list.
- A Async launcher for the GO command was implemented for Neovim, fully async building and testing (Beta).
- Integrated with the Neovim terminal, launch and other
:GoRun
go commands in their own new terminal. (Beta)
- Alternate between implementation and test code with
:GoAlternate
Installation is also very convenient, just a few three lines of code:
#下载安装
git clone git@github.com:farazdagi/vim-go-ide.git ~/.vim_go_runtimesh ~/.vim_go_runtime/bin/install# run Vim-u ~/. Vimrc.go
Ps:
A) This requires vim to open LUA:
Brew install VIM--with-lua--override-system-vim
b) If you need class resolution, you need to turn Ctag
Original: http://farazdagi.com/blog/2015/vim-as-golang-ide/
The effect is as follows: