vim: how to turn on syntax highlighting

Normal mode

How to turn on syntax highlighting for your current session

:syntax on

.vimrc configuration

How to default syntax to “on” for all vim sessions

Remember to always  back up your config files, simply add this to your .vimrc

syntax on

Try different colors

How to cycle through available color schemes for your current session

:colorscheme <Tab>

:colo <Tab> for short

How to change your default color scheme

If you want to change the syntax highlighting colors of your vim setup, the simplest way is to select a preloaded color scheme.

On Mac, your vim files are likely in /usr/share/vim/vim<version_number>/, with your version number being unique to your setup.

How to list your available color schemes:

ls /usr/share/vim/vim<version_number

These are my available colors:

Try a bunch of these colors and find the one you like.

How to set your color scheme

Add this to your ~/.vimrc

colorscheme darkblue

 

Thats it! See more at the docs

 

Leave a Reply

Your email address will not be published. Required fields are marked *