Reputation: 13840
How can I disable highlightning of whitespace when editing Go source files in Vim?
Also, why does Vim highlight whitespace for Go source files, when it doesn't do it for Python source files - is highlighting of whitespace enabled depending on the file extension, e.g. .go
or .py
?
Vim version:
nlykkei:~$ vim --version
VIM - Vi IMproved 8.1 (2018 May 18, compiled Sep 16 2019 18:46:24)
Included patches: 1-503, 505-680, 682-1312
Compiled by [email protected]
Normal version without GUI. Features included (+) or not (-):
+acl +extra_search -mouse_netterm -tag_old_static
-arabic -farsi +mouse_sgr -tag_any_white
+autocmd +file_in_path -mouse_sysmouse -tcl
+autochdir +find_in_path -mouse_urxvt -termguicolors
-autoservername +float +mouse_xterm +terminal
-balloon_eval +folding +multi_byte +terminfo
-balloon_eval_term -footer +multi_lang +termresponse
-browse +fork() -mzscheme +textobjects
+builtin_terms -gettext +netbeans_intg +textprop
+byte_offset -hangul_input +num64 +timers
+channel +iconv +packages +title
+cindent +insert_expand +path_extra -toolbar
-clientserver +job -perl +user_commands
-clipboard +jumplist +persistent_undo -vartabs
+cmdline_compl -keymap +postscript +vertsplit
+cmdline_hist +lambda +printer +virtualedit
+cmdline_info -langmap -profile +visual
+comments +libcall +python/dyn +visualextra
-conceal +linebreak -python3 +viminfo
+cryptv +lispindent +quickfix +vreplace
+cscope +listcmds +reltime +wildignore
+cursorbind +localmap -rightleft +wildmenu
+cursorshape -lua +ruby/dyn +windows
+dialog_con +menu +scrollbind +writebackup
+diff +mksession +signs -X11
+digraphs +modify_fname +smartindent -xfontset
-dnd +mouse +startuptime -xim
-ebcdic -mouseshape +statusline -xpm
-emacs_tags -mouse_dec -sun_workshop -xsmp
+eval -mouse_gpm +syntax -xterm_clipboard
+ex_extra -mouse_jsbterm +tag_binary -xterm_save
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/share/vim"
Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -DMACOS_X_UNIX -g -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
Linking: gcc -L/usr/local/lib -o vim -lm -lncurses -liconv -framework Cocoa
Upvotes: 0
Views: 246
Reputation: 361585
It's not highlighting nor any plugin. It's syntax coloring for so-called "whitespace errors" — trailing whitespace that shouldn't be there. It's coming from the built-in syntax/go.vim
.
You can customize the highlighting by setting various global go_*
variables. The block comment at the top of go.vim
explains them:
" Options:
" There are some options for customizing the highlighting; the recommended
" settings are the default values, but you can write:
" let OPTION_NAME = 0
" in your ~/.vimrc file to disable particular options. You can also write:
" let OPTION_NAME = 1
" to enable particular options. At present, all options default to on.
"
" - g:go_highlight_array_whitespace_error
" Highlights white space after "[]".
" - g:go_highlight_chan_whitespace_error
" Highlights white space around the communications operator that don't
" follow the standard style.
" - g:go_highlight_extra_types
" Highlights commonly used library types (io.Reader, etc.).
" - g:go_highlight_space_tab_error
" Highlights instances of tabs following spaces.
" - g:go_highlight_trailing_whitespace_error
" Highlights trailing white space.
Notes:
g:
sets the options globally.:set syntax
to check the current language.filetype.vim
for filename to language mappings.Upvotes: 3