Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

goimports is default behavior #2855

Closed
strogiyotec opened this issue Apr 24, 2020 · 4 comments
Closed

goimports is default behavior #2855

strogiyotec opened this issue Apr 24, 2020 · 4 comments

Comments

@strogiyotec
Copy link

Good day, thank you for this amazing plugin. I'm going through Tutorial part and noticed this feature

If you haven't heard yet, it's called goimports. goimports is a replacement for gofmt. You have two ways of using it. The first (and recommended) way is telling vim-go to use it when saving the file:
let g:go_fmt_command = "goimports"

From the text above it's not clear that goimports is default behavior and it will be called every time when you save a file. Could I create a pool request with new text something like this ?

The first (default and recommended) way is telling vim-go to use it when saving the file:
let g:go_fmt_command = "goimports"
``
@bhcleek
Copy link
Collaborator

bhcleek commented Apr 24, 2020

It's only called every time when g:go_fmt_autosave is set. I'd accept a PR that makes that clear.

@strogiyotec
Copy link
Author

strogiyotec commented Apr 24, 2020

@bcarrell Thank you for quick response. With my configuration it works by default every time when I save file (:w) even without

let g:go_fmt_command = "goimports"

in config file. Here is my vimrc

"Vim go
 call plug#begin('~/.vim/plugged')
 Plug 'fatih/vim-go', { 'do': ':GoUpdateBinaries' }
 Plug 'AndrewRadev/splitjoin.vim'
 Plug 'ctrlpvim/ctrlp.vim'
 call plug#end()
  let g:go_highlight_functions = 1
  let g:go_auto_type_info = 1
  let g:go_rename_command = 'gopls'

This is the reason why I thought that goimports is enabled by default. Is it a problem in my conf ?

@bhcleek
Copy link
Collaborator

bhcleek commented Apr 24, 2020

That's a bug. I put up a PR to fix it: #2858

@strogiyotec
Copy link
Author

Ok in this case there is no need to add this info to Tutorial , thank you , I will close the ticket

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants