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