1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-02-02 22:30:04 +08:00

docs(go): update lang#go layer page

This commit is contained in:
wsdjeg 2022-05-27 11:48:19 +08:00
parent 8ab7225f5d
commit 50a93380d3

View File

@ -10,13 +10,14 @@ description: "This layer is for golang development. It also provides additional
- [Description](#description)
- [Install](#install)
- [Features](#features)
- [Layer options](#layer-options)
- [Key bindings](#key-bindings)
<!-- vim-markdown-toc -->
## Description
This layer is for golang development. It also provides additional language-specific key mappings.
This layer is for [golang](https://go.dev/) development. It also provides additional language-specific key mappings.
## Install
@ -42,6 +43,39 @@ go install github.com/jstemmer/gotags@latest
- goto definition
- reference finder
## Layer options
1. `enabled_linters`: set a list of enabled lint for golang. by default this
option is `['golint']`. The available linters includes: `go`, `gometalinter`
2. go_file_head: the default file head for golang source code.
```
[layers]
name = "lang#go"
go_file_head = [
'#!/usr/bin/python3',
'# -*- coding : utf-8 -*-'
''
]
```
3. `go_interpreter`: Set the interpreter of go.
```
[[layers]]
name = 'lang#go'
go_interpreter = '~/download/bin/go'
```
4. format_on_save: enable/disable code formation when save go file. This
options is disabled by default, to enable it:
```
[[layers]]
name = 'lang#go'
format_on_save = true
```
## Key bindings
**Import key bindings:**
@ -72,7 +106,7 @@ go install github.com/jstemmer/gotags@latest
**Code formatting:**
the default key bindings for formatting current buffer is `SPC b f`, and this key bindings is defined in [format layer](<>). You can also use `g=` to indent current buffer.
the default key bindings for formatting current buffer is `SPC b f`, and this key bindings is defined in [format layer](). You can also use `g=` to indent current buffer.
To make neoformat support go files, you should have [go-fmt](http://golang.org/cmd/gofmt/) command available, or
install [goimports](https://godoc.org/golang.org/x/tools/cmd/goimports). `go-fmt` is delivered by golang's default installation, so make sure you have correctly setup your go environment.