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.

cd ~
vim .vimrc

Put the below in the .vimrc file.

filetype plugin indent on
syntax on

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

:syntax on

Turn it off

:syntax it off

Search within Codexpedia

Custom Search

Search the entire web

Custom Search