Closed orlangure closed 5 years ago
It works fine for me. If you can provide a more detailed description and a minimal vimrc, perhaps we can identify why it's not working for you.
Thank you for a quick response. Below are the steps I followed to reproduce the issue:
" ~/minvimrc
call plug#begin('~/.vim/plugged')
Plug 'fatih/vim-go', { 'do': ':GoUpdateBinaries' }
call plug#end()
$ vim -u ~/minvimrc
:version
VIM - Vi IMproved 8.1 (2018 May 18, compiled Dec 16 2018 05:28:49)
macOS version
Included patches: 1-600
Compiled by Homebrew
Huge version without GUI. Features included (+) or not (-):
+acl +byte_offset +conceal -ebcdic +folding +keymap +menu +mouse_sgr +packages +quickfix -sun_workshop +termresponse +virtualedit -X11
+arabic +channel +cryptv +emacs_tags -footer +lambda +mksession -mouse_sysmouse +path_extra +reltime +syntax +textobjects +visual -xfontset
+autocmd +cindent +cscope +eval +fork() +langmap +modify_fname +mouse_urxvt +perl +rightleft +tag_binary +textprop +visualextra -xim
+autochdir -clientserver +cursorbind +ex_extra +gettext +libcall +mouse +mouse_xterm +persistent_undo +ruby +tag_old_static +timers +viminfo -xpm
-autoservername +clipboard +cursorshape +extra_search -hangul_input +linebreak -mouseshape +multi_byte +postscript +scrollbind -tag_any_white +title +vreplace -xsmp
-balloon_eval +cmdline_compl +dialog_con +farsi +iconv +lispindent +mouse_dec +multi_lang +printer +signs -tcl -toolbar +wildignore -xterm_clipboard
+balloon_eval_term +cmdline_hist +diff +file_in_path +insert_expand +listcmds -mouse_gpm -mzscheme +profile +smartindent +termguicolors +user_commands +wildmenu -xterm_save
-browse +cmdline_info +digraphs +find_in_path +job +localmap -mouse_jsbterm +netbeans_intg -python +startuptime +terminal +vartabs +windows
++builtin_terms +comments -dnd +float +jumplist +lua +mouse_netterm +num64 +python3 +statusline +terminfo +vertsplit +writebackup
system vimrc file: "$VIM/vimrc"
user vimrc file: "$HOME/.vimrc"
2nd user vimrc file: "~/.vim/vimrc"
user exrc file: "$HOME/.exrc"
defaults file: "$VIMRUNTIME/defaults.vim"
fall-back for $VIM: "/usr/local/share/vim"
Compilation: clang -c -I. -Iproto -DHAVE_CONFIG_H -DMACOS_X -DMACOS_X_DARWIN -g -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
Linking: clang -L. -fstack-protector -L/usr/local/lib -L/usr/local/opt/libyaml/lib -L/usr/local/opt/openssl/lib -L/usr/local/opt/readline/lib -L/usr/local/lib -o vim -lncurses -liconv -lintl -framework AppKit -L/usr/local/opt/lua/lib -llua5.3 -mmacosx-version-m
in=10.14 -fstack-protector-strong -L/usr/local/lib -L/usr/local/Cellar/perl/5.28.0/lib/perl5/5.28.0/darwin-thread-multi-2level/CORE -lperl -lm -lutil -lc -L/usr/local/opt/python/Frameworks/Python.framework/Versions/3.7/lib/python3.7/config-3.7m-darwin -lpython3.7m -fram
ework CoreFoundation -lruby.2.5.3 -lobjc
:let g:
plug_home /Users/yury/.vim/plugged
syntax_on #1
did_load_filetypes #1
did_indent_on #1
loaded_2html_plugin vim8.1_v1
loaded_plug #1
go_loaded_install #1
plugs_order ['vim-go']
did_load_ftplugin #1
ft_ignore_pat \.\(Z\|gz\|bz2\|zip\|tgz\)$
plugs {'vim-go': {'uri': 'https://git::@github.com/fatih/vim-go.git', 'dir': '/Users/yury/.vim/plugged/vim-go/', 'frozen': 0, 'branch': 'master', 'do': ':GoUpdateBinaries'}}
:e main.go
:let g:
go_highlight_format_strings #1
syntax_on #1
go_highlight_space_tab_error #0
loaded_plug #1
go_highlight_build_constraints #0
go_loaded_install #1
go_highlight_generate_tags #0
go_highlight_function_arguments #0
go_highlight_trailing_whitespace_error #0
did_load_filetypes #1
go_highlight_function_calls #0
go_highlight_operators #0
go_highlight_variable_declarations #0
go_jump_to_error #1
go_highlight_string_spellcheck #1
go_highlight_variable_assignments #0
did_indent_on #1
go_highlight_chan_whitespace_error #0
go_highlight_extra_types #0
plugs_order ['vim-go']
go_highlight_fields #0
go_highlight_functions #0
plugs {'vim-go': {'uri': 'https://git::@github.com/fatih/vim-go.git', 'dir': '/Users/yury/.vim/plugged/vim-go/', 'frozen': 0, 'branch': 'master', 'do': ':GoUpdateBinaries'}}
plug_home /Users/yury/.vim/plugged
go_loaded_gosnippets #1
go_highlight_array_whitespace_error #0
go_highlight_types #0
loaded_2html_plugin vim8.1_v1
did_load_ftplugin #1
ft_ignore_pat \.\(Z\|gz\|bz2\|zip\|tgz\)$
$ cd <plugin dir>
$ git checkout 8342cd4
(prior to refactor)
Restart vim, :w
- file is reformatted.
Is this the complete vimrc that you used to duplicate the problem?
call plug#begin('~/.vim/plugged')
Plug 'fatih/vim-go', { 'do': ':GoUpdateBinaries' }
call plug#end()
When I use that, the file gets formatted on write without any issue.
Yes, this is the complete file. I removed all plugin folders and used that file with -u
flag, as I wrote. I think that the following can help to understand the issue:
GoFmt starts running automatically if I explicitly
source ~/.vimrc
and:e
the file again, and stops when I restart vim.
Since the refactoring changed when and how a configuration is loaded, it probably won't load automatically anymore, but will load when I source ~/.vimrc
. Does that give you any hint of what might went wrong? How can I help in debugging this issue further?
Here's an animated gif showing that with the vimrc you provided, a file is formatted on write:
What you've described is pretty clear, but I just can't replicate the problem you're seeing.
What were the errors you saw while opening the file? Do they possibly mean that something else was loaded besides vim-go
?
Also, I used an existing file in my tests (:e main.go
). I'll try the same with a new file tomorrow, but can you make sure the behavior is the same with an existing go file?
Anyway tomorrow I'll look more into this, it is very weird that checking out master instead of the commit before the refactoring breaks things.
What were the errors you saw while opening the file? Do they possibly mean that something else was loaded besides vim-go?
They're because the vimrc you provided does not use set nocompatible
and therefore the syntax file has some issues, and have nothing to do the behavior you're describing.
I'll try the same with a new file tomorrow, but can you make sure the behavior is the same with an existing go file?
It's the same behavior whether the file is new or not.
OK, I wiped my vim configuration entirely (removed .vim
and .vimrc
) and reinstalled everything from scratch. Now I cannot reproduce the issue as well. There probably was a conflict between some old garbage that was left somewhere in .vim
folder.
Sorry for wasting your time.
Since 1ed9b521929606a282edc72c7627addb8c3914b9,
go_fmt_autosave
stopped runningGoFmt
on every save. Running:GoFmt
manually works as expected.I use default configuration except for two options:
GoFmt
starts running automatically if I explicitlysource ~/.vimrc
and:e
the file again, and stops when I restart vim.