I've seen multiple places(including here ) that to add syntax highlighting you have to add certain lines to the .vimrc:
"Stuff for GoLang"
filetype off
filetype plugin indent off
set runtimepath+=$GOROOT/misc/vim
filetype plugin indent on
syntax on
That is what's currently in my .vimrc
Restarted vim, terminal, system, and still no highlighting. Any suggestions?
Okay guys, I go the answer:
$GOROOT
needs to be defined or you can simply put the location of your go installation.
Ensure that the corresponding runtime files are actually there.
$GOROOT
must be defined; check with :echo $GOROOT
syntax/go.vim
) below $GOROOT/misc/vim
. Check with :echo filereadable($GOROOT . '/misc/vim/syntax/go.vim')
. :scriptnames
and :syntax list
.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.