Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/haya14busa/vim-gofmt
Formats Go source code asynchronously with multiple Go formatters.
https://github.com/haya14busa/vim-gofmt
formatter go golang vim vim-plugin
Last synced: 3 months ago
JSON representation
Formats Go source code asynchronously with multiple Go formatters.
- Host: GitHub
- URL: https://github.com/haya14busa/vim-gofmt
- Owner: haya14busa
- Created: 2017-02-05T16:45:38.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2017-05-04T02:15:25.000Z (over 7 years ago)
- Last Synced: 2024-10-04T16:50:36.193Z (4 months ago)
- Topics: formatter, go, golang, vim, vim-plugin
- Language: Vim script
- Homepage:
- Size: 4.88 KB
- Stars: 11
- Watchers: 3
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# vim-gofmt
[![LICENSE](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)vim-gofmt formats Go source code asynchronously with multiple Go formatters.
It's experimental and API may changes, but it should work.
## Usage
### :Fmt
`:Fmt` formats Go source code in current buffer using `g:gofmt_formatters`.
It runs asynchronously and doesn't block editing.
### g:gofmt_formatters
default:
```vim
let g:gofmt_formatters = [
\ { 'cmd': 'gofmt', 'args': ['-s', '-w'] },
\ { 'cmd': 'goimports', 'args': ['-w'] },
\ ]
```Each formatters are used in consecutively in order of the list.
Example:
```
$ go get -u github.com/rhysd/gofmtrlx
$ go get -u github.com/haya14busa/go-typeconv/cmd/gotypeconv
``````vim
let g:gofmt_formatters = [
\ { 'cmd': 'gofmtrlx', 'args': ['-s', '-w'] },
\ { 'cmd': 'goimports', 'args': ['-w'] },
\ { 'cmd': 'gotypeconv', 'args': ['-w'] },
\ ]
```## :bird: Author
haya14busa (https://github.com/haya14busa)