mirror of
https://github.com/SpaceVim/SpaceVim.git
synced 2025-02-09 08:10:03 +08:00
docs(go): update lang#go
layer page
This commit is contained in:
parent
8ab7225f5d
commit
50a93380d3
@ -10,13 +10,14 @@ description: "This layer is for golang development. It also provides additional
|
|||||||
- [Description](#description)
|
- [Description](#description)
|
||||||
- [Install](#install)
|
- [Install](#install)
|
||||||
- [Features](#features)
|
- [Features](#features)
|
||||||
|
- [Layer options](#layer-options)
|
||||||
- [Key bindings](#key-bindings)
|
- [Key bindings](#key-bindings)
|
||||||
|
|
||||||
<!-- vim-markdown-toc -->
|
<!-- vim-markdown-toc -->
|
||||||
|
|
||||||
## Description
|
## 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
|
## Install
|
||||||
|
|
||||||
@ -42,6 +43,39 @@ go install github.com/jstemmer/gotags@latest
|
|||||||
- goto definition
|
- goto definition
|
||||||
- reference finder
|
- 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
|
## Key bindings
|
||||||
|
|
||||||
**Import key bindings:**
|
**Import key bindings:**
|
||||||
@ -72,7 +106,7 @@ go install github.com/jstemmer/gotags@latest
|
|||||||
|
|
||||||
**Code formatting:**
|
**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
|
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.
|
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.
|
||||||
|
Loading…
Reference in New Issue
Block a user