How to Enable Syntax Highlighting in Vim

There are a few different ways to enable Syntax Highlighting in Vim.

Option 1 – Edit ~/.vimrc

Add syntax on to your local ~/.vimrc

echo "syntax on" >> ~/.vimrc
Code language: Bash (bash)

Option 2 – Override System Vim (Mac)

cd vim --version xcode-select --install ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" brew doctor brew install vim --override-system-vim vim --version
Code language: Bash (bash)

Option 3 – Toggle in Vim

You can use Vim Commands while in Vim itself:

:syntax on
Code language: Bash (bash)
Tags:
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments