spf13 / spf13-vim

The ultimate vim distribution
http://vim.spf13.com
Apache License 2.0
15.56k stars 3.63k forks source link

Error detected while processing function StripTrailingWhitespace #957

Open MaerF0x0 opened 8 years ago

MaerF0x0 commented 8 years ago

stock spf13-vim v3.0 Whenever my go files have a gofmt error in them (eg:

a := struct{A string}{
  "Fish"  // <--- Missing comma
}

It gets stuck and I have to press enter to continue.

Gofmt returned error
Error detected while processing function StripTrailingWhitespace:
line    6:
E21: Cannot make changes, 'modifiable' is off
"my_go_file.go" 194L, 4842C written
Press ENTER or type command to continue
dancompton commented 8 years ago

Same issue here and It's not vim-go related. https://github.com/fatih/vim-go/issues/723

Might be related to vim --with lua as I resolved this issue via installing vim with lua on osx

rm -rf ~/.vim* // or uninstall spf13 vim
brew unlink vim
brew install vim --with-lua
// install spf13-vim
uhpewpewpew commented 8 years ago

This simple faulty code

package main

dfafd

triggers the same error

Gofmt returned error
Error detected while processing function StripTrailingWhitespace:
line    6:
E21: Cannot make changes, 'modifiable' is off
"example.go" 4L, 25C written
Press ENTER or type command to continue

@dan-compton not related to vim --with lua, because here is my vim version

VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Mar 31 2015 23:35:24)
Included patches: 1-488, 576
Modified by pkg-vim-maintainers@lists.alioth.debian.org
Compiled by jamessan@debian.org
Huge version without GUI.  Features included (+) or not (-):
+acl             +farsi           +mouse_netterm   +syntax
+arabic          +file_in_path    +mouse_sgr       +tag_binary
+autocmd         +find_in_path    -mouse_sysmouse  +tag_old_static
-balloon_eval    +float           +mouse_urxvt     -tag_any_white
-browse          +folding         +mouse_xterm     +tcl
++builtin_terms  -footer          +multi_byte      +terminfo
+byte_offset     +fork()          +multi_lang      +termresponse
+cindent         +gettext         -mzscheme        +textobjects
-clientserver    -hangul_input    +netbeans_intg   +title
-clipboard       +iconv           +path_extra      -toolbar
+cmdline_compl   +insert_expand   +perl            +user_commands
+cmdline_hist    +jumplist        +persistent_undo +vertsplit
+cmdline_info    +keymap          +postscript      +virtualedit
+comments        +langmap         +printer         +visual
+conceal         +libcall         +profile         +visualextra
+cryptv          +linebreak       +python          +viminfo
+cscope          +lispindent      -python3         +vreplace
+cursorbind      +listcmds        +quickfix        +wildignore
+cursorshape     +localmap        +reltime         +wildmenu
+dialog_con      +lua             +rightleft       +windows
+diff            +menu            +ruby            +writebackup
+digraphs        +mksession       +scrollbind      -X11
-dnd             +modify_fname    +signs           -xfontset
-ebcdic          +mouse           +smartindent     -xim
+emacs_tags      -mouseshape      -sniff           -xsmp
+eval            +mouse_dec       +startuptime     -xterm_clipboard
+ex_extra        +mouse_gpm       +statusline      -xterm_save
+extra_search    -mouse_jsbterm   -sun_workshop    -xpm
   system vimrc file: "$VIM/vimrc"
     user vimrc file: "$HOME/.vimrc"
 2nd user vimrc file: "~/.vim/vimrc"
      user exrc file: "$HOME/.exrc"
  fall-back for $VIM: "/usr/share/vim"
Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H     -g -O2 -fPIE -fstack-protector-strong -Wformat -Werror=format-security -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1     -I/usr/include/tcl8.6  -D_REENTRANT=1  -D_THREAD_SAFE=1  -D_LARGEFILE64_SOURCE=1
Linking: gcc   -L. -Wl,-z,relro -L/build/ruby2.1-64qTCU/ruby2.1-2.1.5/debian/lib -fstack-protector -rdynamic -Wl,-export-dynamic -Wl,-E  -fPIE -pie -Wl,-z,relro -Wl,-z,now -Wl,--as-needed -o vim        -lm -ltinfo -lnsl  -lselinux  -lacl -lattr -lgpm -ldl  -L/usr/lib -llua5.2 -Wl,-E  -fstack-protector -L/usr/local/lib  -L/usr/lib/x86_64-linux-gnu/perl/5.20/CORE -lperl -ldl -lm -lpthread -lcrypt -L/usr/lib/python2.7/config-x86_64-linux-gnu -lpython2.7 -lpthread -ldl -lutil -lm -Xlinker -export-dynamic -Wl,-O1 -Wl,-Bsymbolic-functions  -L/usr/lib/x86_64-linux-gnu -ltcl8.6 -ldl -lz -lpthread -lieee -lm -lruby-2.1 -lpthread -lgmp -ldl -lcrypt -lm
ahuret commented 7 years ago

Found a hacky workaround. In ~/vimrc, on line 256 there is : autocmd FileType c,cpp,java,go,php,javascript,puppet,python,rust,twig,xml,yml,perl,sql autocmd BufWritePre <buffer> if !exists('g:spf13_keep_trailing_whitespace') .......

Removing "go" from the FileType list "fix" the problem.