Home > Backend Development > Golang > How do I Enable GoLang Syntax Highlighting in VIM with Go 1.4 and Later?

How do I Enable GoLang Syntax Highlighting in VIM with Go 1.4 and Later?

Barbara Streisand
Release: 2024-11-15 08:32:02
Original
436 people have browsed it

How do I Enable GoLang Syntax Highlighting in VIM with Go 1.4 and Later?

Add GoLang Syntax Highlighting for VIM

You're looking to set up GoLang syntax highlighting for VIM. While the instructions you're following are generally correct, they no longer apply to the latest Go distributions.

Update:

Go 1.4 and later no longer include Go support files for editors. This information has been moved to a curated wiki page.

Solution:

Instead of the instructions you found at http://go-lang.cat-v.org/text-editors/vim/, follow these steps:

  1. Open your .vimrc file.
  2. Add the following lines:
" Clear filetype flags before changing runtimepath to force Vim to reload them.
filetype off
filetype plugin indent off
set runtimepath+=$GOROOT/misc/vim
filetype plugin indent on
syntax on
Copy after login
  1. Save and close .vimrc.

Note that you may need to adjust the path to $GOROOT/misc/vim depending on your installation. Once you've completed these steps, GoLang syntax highlighting should be enabled in VIM.

The above is the detailed content of How do I Enable GoLang Syntax Highlighting in VIM with Go 1.4 and Later?. For more information, please follow other related articles on the PHP Chinese website!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template