Why isn't Go syntax highlighting working in Vim after installing go.vim?

Susan Sarandon
Release: 2024-11-12 19:29:02
Original
715 people have browsed it

Why isn't Go syntax highlighting working in Vim after installing go.vim?

Configuring Go Syntax Highlighting in Vim

Attempting to add Go syntax highlighting to Vim, you followed the instructions to copy go.vim to the syntax directory and create a ftdetect file. However, the highlighting is not activating.

Solution

As per the Go 1.4 Release Notes, Go support for editors like Vim has been removed from the standard repository. Instead, you can find installation instructions for Vim plugins on the Go Wiki:

To use all the Vim plugins, add these lines to your $HOME/.vimrc.

" Some Linux distributions set filetype in /etc/vimrc.
" 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

Update your .vimrc file with these lines, and Vim will automatically load the necessary syntax settings for Go files.

The above is the detailed content of Why isn't Go syntax highlighting working in Vim after installing go.vim?. 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