c8c5ac50e9f80b63035c6756dfd76da4dba7d30a
[webi-installers/.git] / vim-go / README.md
1 ---
2 title: vim-go
3 homepage: https://github.com/fatih/vim-go
4 tagline: |
5   vim-go adds Go language support for Vim.
6 description: |
7   `vim-go` provides integration with various official and 3rd part go tooling for linting, vetting, etc.
8
9   You'll also need `ALE`, `syntastic`, or similar.
10 ---
11
12 ### How to install by hand
13
14 ```bash
15 git clone --depth=1 https://github.com/fatih/vim-go.git ~/.vim/pack/plugins/start/vim-go
16 ```
17
18 ### How to configure your `.vimrc`
19
20 ```vimrc
21 " don't check syntax immediately on open or on quit
22 let g:syntastic_check_on_open = 1
23 let g:syntastic_check_on_wq = 0
24
25 " we also want to get rid of accidental trailing whitespace on save
26 autocmd BufWritePre * :%s/\s\+$//e
27 ```
28
29 ```vimrc
30 """""""""""""""""""""""""""
31 " Golang-specific options "
32 """""""""""""""""""""""""""
33
34 " tell syntastic that go, golint, and errcheck are installed
35 let g:syntastic_go_checkers = ['go', 'golint', 'errcheck']
36
37 " tell vim-go that goimports is installed
38 let g:go_fmt_command = "goimports"
39
40 " tell vim-go to highlight
41 let g:go_highlight_functions = 1
42 let g:go_highlight_methods = 1
43 let g:go_highlight_structs = 1
44 let g:go_highlight_operators = 1
45 let g:go_highlight_build_constraints = 1
46 ```
47
48 ### How to install go language tools
49
50 ```bash
51 # gopls
52 go get golang.org/x/tools/gopls
53
54 # golint
55 go get golang.org/x/lint/golint
56
57 # errcheck
58 go get github.com/kisielk/errcheck
59
60 # gotags
61 go get github.com/jstemmer/gotags
62
63 # goimports
64 go get golang.org/x/tools/cmd/goimports
65
66 # gorename
67 go get golang.org/x/tools/cmd/gorename
68
69 # gotype
70 go get golang.org/x/tools/cmd/gotype
71 ```