Syntax Colouring/Highlighting in vi or vim Editor

Vim or vi is a text editor. It can be used to edit all kinds of plain text. It is especially useful for editing programs or UNIX/Linux configuration files.

Task: Turn on color syntax highlighting

Open file (for example file.c):
$ vi file.c

Now press ESC key, type : syntax on
:syntax on

Task: Turn off color syntax highlighting

To turn it back off, press ESC key, type : syntax off
:syntax off

You can edit ~/.vimrc file and add command syntax on to it so that next you will start vim with color syntax highlighting option
$ cd
$ vi .vimrc

Append the following line:
syntax on

Advertisements

About Priyanka Kapoor

Simple, Hardworking & friendly.....
This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s