Set syntax highlighting in Vi/Vim with dark background

I always forget how to do this and I need to write it down:

Turn on syntax highlighting with:

:syntax on

If highlighting looks to dark, then you are probably using dark background, so set it to achieve better readability:

:set background=dark

To make these two changes permanent, edit ~/.vimrc file and enter:

syntax on
  set background=dark

To turn of syntax highlighting do:

:syntax off

To go back to light background do:

:set background=light

or delete the lines from ~/.vimrc file.

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.