golang: added guide to install and setup go in vim

master
TiynGER 3 years ago
parent 84117cdb93
commit fedb20d9fb

@ -0,0 +1,41 @@
# GoLang in Vim
GoLang is a common programming language.
In this entry we will focus on making vim support Go and use vim as an ide for it.
This guide is based on a guide from [octetz.com](https://octetz.com/docs/2019/2019-04-24-vim-as-a-go-ide/).
## Build, Test, Run, Docs, Debug, Format
To enable most of the basic functions of an IDE you need to install `vim-go` via
`vim plug`.
For this add `Plug 'fatih/vim-go' " better support for golang` in your plug section
in the `init.vim` file.
Then run `:PlugInstall` and `:GoInstallBinaries` inside `nvim`.
Finally add `let g:go_def_mapping_enabled = 0` to your `init.vim` to make sure
the mapping `gd` will be used by `coc` and its language server.
## Autocompletion
### Coc
To enable autocompletion for [coc](coc.md) you need to install `ccls`.
After that you need to add the following lines to your coc config file.
```json
{
"languageserver": {
"golang": {
"command": "gopls",
"rootPatterns": [
"go.mod",
".vim/",
".git/",
".hg/"
],
"filetypes": [
"go"
]
}
}
}
```

@ -0,0 +1,21 @@
# GoLang
GoLang is a common programming language.
## Installation
To get go working you basically just need to install [Go](https://golang.org/doc/install).
Make sure to set the `GOPATH` and the `GOBIN` variable and add the last to the `Path`
by adding the following to your `.profile`:
```sh
export GOPATH="${HOME}/code/go"
export GOBIN="${GOPATH}/bin"
export PATH="${GOBIN}:${PATH}"
```
## IDE
### Vim
The steps to make Vim a Go IDE are described in [the vim section of this wiki](../linux/vim/golang.md).
Loading…
Cancel
Save