Turn on syntax highlighting for vim on Mac OS
The .vimrc file is used for optional runtime configuration settings to initialize Vim when it starts. By default, Mac OS doesn’t always have the .vimrc file and doesn’t have the syntax coloring enabled for vim. To enable the syntax coloring for vim, go to your home directory, and open or create the .vimrc file if it doesn’t already exist.
[code language=”shell”]
cd ~
vim .vimrc
[/code]
Put the below in the .vimrc file.
[code language=”shell”]
filetype plugin indent on
syntax on
[/code]
To turn on and off the vim syntax highlighting while vim is already opened. Press Esc and then type the below and enter.
Turn it on
[code language=”shell”]
:syntax on
[/code]
Turn it off
[code language=”shell”]
:syntax it off
[/code]
Search within Codexpedia
Search the entire web