Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mattn/vim-goimports
Vim plugin for Minimalist Gopher
https://github.com/mattn/vim-goimports
golang vim
Last synced: 2 months ago
JSON representation
Vim plugin for Minimalist Gopher
- Host: GitHub
- URL: https://github.com/mattn/vim-goimports
- Owner: mattn
- License: other
- Created: 2019-12-20T02:23:12.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2022-07-23T15:43:00.000Z (over 2 years ago)
- Last Synced: 2024-10-23T04:16:35.504Z (2 months ago)
- Topics: golang, vim
- Language: Vim script
- Homepage:
- Size: 34.2 KB
- Stars: 150
- Watchers: 5
- Forks: 13
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# vim-goimports
Vim plugin for Minimalist Gopher
## Features
* Auto-formatting with `:w`
* GoImport/GoImportAsThis plugin is mostly based on vim-go.
## Will not do
* Add new commands
* Modify syntax## Usage
```
:w
```## Installation
For [vim-plug](https://github.com/junegunn/vim-plug) plugin manager:
```viml
Plug 'mattn/vim-goimports'
```## Configuration
```viml
" enable auto format when write (default)
let g:goimports = 1
" disable auto format. but :GoImportRun will work.
let g:goimports = 0
```* `g:goimports_simplify` - make simplify (a.k.a. `gofmt -s`) in formatting,
when make value of this `1` (default disabled).```viml
" enable simplify filter
let g:goimports_simplify = 1
" disable simplify filter
unlet! g:goimports_simplify
```* `g:goimports_local` - use `-local` option when running `goimports`.
This is useful to import closed-source packages. (comma separated list)```viml
" run goimports with `-local "github.com/myrepo"` option
let g:goimports_local = 'github.com/myrepo'
```* To replace goimports command with the drop in replacement tool (e.g. [gofumpt](https://github.com/mvdan/gofumpt)).
```viml
" goimport (default)
let g:goimports_cmd = 'goimports'
let g:goimports_simplify_cmd = 'gofmt'
" gofumpt
let g:goimports_cmd = 'gofumports'
let g:goimports_simplify_cmd = 'gofumpt'
```* To not trigger the location list if errors are present, you can use this option :
```viml
" default is 1
let g:goimports_show_loclist = 0
```## Requirements
* goimports
* gofmt (optional: for `g:goimports_simplify = 1`)## License
MIT
## Author
Yasuhiro Matsumoto (a.k.a. mattn)