mirror of
https://github.com/amix/vimrc
synced 2025-06-16 01:25:00 +08:00
Updated plugins
This commit is contained in:
@ -39,10 +39,15 @@ disabled/enabled easily.
|
||||
* Share your current code to [play.golang.org](http://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`
|
||||
* All commands support collecting and displaying errors in Vim's location
|
||||
list.
|
||||
* A async launcher for the go command is implemented for Neovim, fully async
|
||||
building and testing (beta).
|
||||
* Integrated with the Neovim terminal, launch `:GoRun` and other go commands
|
||||
in their own new terminal. (beta)
|
||||
* Alternate between implementation and test code with `:GoAlternate`
|
||||
|
||||
## Install
|
||||
|
||||
@ -73,15 +78,18 @@ installed binaries.
|
||||
|
||||
* Autocompletion is enabled by default via `<C-x><C-o>`. To get real-time
|
||||
completion (completion by type) install:
|
||||
[YCM](https://github.com/Valloric/YouCompleteMe) or
|
||||
[neocomplete](https://github.com/Shougo/neocomplete.vim).
|
||||
[neocomplete](https://github.com/Shougo/neocomplete.vim) for Vim or
|
||||
[deoplete](https://github.com/Shougo/deoplete.nvim) and
|
||||
[deoplete-go](https://github.com/zchee/deoplete-go) for NeoVim
|
||||
* To display source code tag information on a sidebar install
|
||||
[tagbar](https://github.com/majutsushi/tagbar).
|
||||
* For snippet features install:
|
||||
[ultisnips](https://github.com/SirVer/ultisnips) or
|
||||
[neosnippet](https://github.com/Shougo/neosnippet.vim).
|
||||
* Screenshot color scheme is a slightly modified molokai: [fatih/molokai](https://github.com/fatih/molokai).
|
||||
* For a better documentation viewer checkout: [go-explorer](https://github.com/garyburd/go-explorer).
|
||||
[neosnippet](https://github.com/Shougo/neosnippet.vim) or
|
||||
[ultisnips](https://github.com/SirVer/ultisnips).
|
||||
* Screenshot color scheme is a slightly modified molokai:
|
||||
[fatih/molokai](https://github.com/fatih/molokai).
|
||||
* For a better documentation viewer checkout:
|
||||
[go-explorer](https://github.com/garyburd/go-explorer).
|
||||
|
||||
## Usage
|
||||
|
||||
@ -99,9 +107,9 @@ vim-go has several `<Plug>` mappings which can be used to create custom
|
||||
mappings. Below are some examples you might find useful:
|
||||
|
||||
Run commands such as `go run` for the current file with `<leader>r` or `go
|
||||
build` and `go test` for the current package with `<leader>b` and `<leader>t` respectively.
|
||||
Display beautifully annotated source code to see which functions are covered
|
||||
with `<leader>c`.
|
||||
build` and `go test` for the current package with `<leader>b` and `<leader>t`
|
||||
respectively. Display beautifully annotated source code to see which functions
|
||||
are covered with `<leader>c`.
|
||||
|
||||
```vim
|
||||
au FileType go nmap <leader>r <Plug>(go-run)
|
||||
@ -159,7 +167,8 @@ recommendations, you are free to create more advanced mappings or functions
|
||||
based on `:he go-commands`.
|
||||
|
||||
## Settings
|
||||
Below are some settings you might find useful. For the full list see `:he go-settings`.
|
||||
Below are some settings you might find useful. For the full list see `:he
|
||||
go-settings`.
|
||||
|
||||
By default syntax-highlighting for Functions, Methods and Structs is disabled.
|
||||
To change it:
|
||||
@ -167,6 +176,7 @@ To change it:
|
||||
let g:go_highlight_functions = 1
|
||||
let g:go_highlight_methods = 1
|
||||
let g:go_highlight_structs = 1
|
||||
let g:go_highlight_interfaces = 1
|
||||
let g:go_highlight_operators = 1
|
||||
let g:go_highlight_build_constraints = 1
|
||||
```
|
||||
@ -203,23 +213,39 @@ let g:go_bin_path = expand("~/.gotools")
|
||||
let g:go_bin_path = "/home/fatih/.mypath" "or give absolute path
|
||||
```
|
||||
|
||||
### Location list navigation
|
||||
### Using with Neovim (beta)
|
||||
|
||||
All commands support collecting and displaying errors in Vim's location
|
||||
list.
|
||||
Note: Neovim currently is not a first class citizen for vim-go. You are free
|
||||
to open bugs but I'm not going to look at them. Even though I'm using Neovim
|
||||
myself, Neovim itself is still alpha. So vim-go might not work well as good as
|
||||
in Vim. I'm happy to accept pull requests or very detailed bug reports.
|
||||
|
||||
Quickly navigate through these location lists with `:lne` for next error and `:lp`
|
||||
for previous. You can also bind these to keys, for example:
|
||||
|
||||
Run `:GoRun` in a new tab, horizontal split or vertical split terminal
|
||||
|
||||
```vim
|
||||
map <C-n> :lne<CR>
|
||||
map <C-m> :lp<CR>
|
||||
au FileType go nmap <leader>rt <Plug>(go-run-tab)
|
||||
au FileType go nmap <Leader>rs <Plug>(go-run-split)
|
||||
au FileType go nmap <Leader>rv <Plug>(go-run-vertical)
|
||||
```
|
||||
|
||||
By default new terminals are opened in a vertical split. To change it
|
||||
|
||||
```vim
|
||||
let g:go_term_mode = "split"
|
||||
```
|
||||
|
||||
By default the testing commands run asynchronously in the background and
|
||||
display results with `go#jobcontrol#Statusline()`. To make them run in a new
|
||||
terminal
|
||||
|
||||
```vim
|
||||
let g:go_term_enabled = 1
|
||||
```
|
||||
|
||||
### Using with Syntastic
|
||||
Sometimes when using both `vim-go` and `syntastic` Vim will start lagging while saving and opening
|
||||
files. The following fixes this:
|
||||
Sometimes when using both `vim-go` and `syntastic` Vim will start lagging while
|
||||
saving and opening files. The following fixes this:
|
||||
|
||||
```vim
|
||||
let g:syntastic_go_checkers = ['golint', 'govet', 'errcheck']
|
||||
@ -228,13 +254,17 @@ let g:syntastic_mode_map = { 'mode': 'active', 'passive_filetypes': ['go'] }
|
||||
|
||||
## More info
|
||||
|
||||
Check out the [Wiki](https://github.com/fatih/vim-go/wiki) page for more information. It includes [Screencasts](https://github.com/fatih/vim-go/wiki/Screencasts), an [FAQ
|
||||
section](https://github.com/fatih/vim-go/wiki/FAQ-Troubleshooting), and many other [various pieces](https://github.com/fatih/vim-go/wiki) of information.
|
||||
Check out the [Wiki](https://github.com/fatih/vim-go/wiki) page for more
|
||||
information. It includes
|
||||
[Screencasts](https://github.com/fatih/vim-go/wiki/Screencasts), an [FAQ
|
||||
section](https://github.com/fatih/vim-go/wiki/FAQ-Troubleshooting), and many
|
||||
other [various pieces](https://github.com/fatih/vim-go/wiki) of information.
|
||||
|
||||
## Credits
|
||||
|
||||
* Go Authors for official vim plugins
|
||||
* Gocode, Godef, Golint, Oracle, Goimports, Gotags, Errcheck projects and authors of those projects.
|
||||
* Gocode, Godef, Golint, Oracle, Goimports, Gotags, Errcheck projects and
|
||||
authors of those projects.
|
||||
* Other vim-plugins, thanks for inspiration (vim-golang, go.vim, vim-gocode,
|
||||
vim-godef)
|
||||
* [Contributors](https://github.com/fatih/vim-go/graphs/contributors) of vim-go
|
||||
|
Reference in New Issue
Block a user