Vim plugin for Minimalist Gopher
- Auto-formatting with
:w
- GoImport/GoImportAs
This plugin is mostly based on vim-go.
- Add new commands
- Modify syntax
:w
For vim-plug plugin manager:
Plug 'mattn/vim-goimports'
" 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 this1
(default disabled)." enable simplify filter let g:goimports_simplify = 1 " disable simplify filter unlet! g:goimports_simplify
-
g:goimports_local
- use-local
option when runninggoimports
. This is useful to import closed-source packages. (comma separated list)" 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).
" 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 :
" default is 1 let g:goimports_show_loclist = 0
- goimports
- gofmt (optional: for
g:goimports_simplify = 1
)
MIT
Yasuhiro Matsumoto (a.k.a. mattn)