Table of Contents
Turn On Syntax Highlighting in Vim/Vi Editor
Vim is one of the popular text editors among the software developers & system administrators. The macOS as well as on different Linux Distros Vim comes preinstalled. We can edit code in Vim easily. But the syntax is not highlighted by default in Vim. In this tutorial, you are going to learn How to Turn On Syntax Highlighting in Vim/Vi Editor.
Turn On Syntax Highlighting in Vim
helloworld.c file by using the following command. (We have taken here
helloworld.c as a demo file you can open any program file.)
Esckey to come in normal mode if you are in any other mode.
The enter following command and hit
The output should be:
Turn On Syntax Highlighting in Vim Permanently
We can set syntax highlighting permanent by editing
~/.vimrc file. To do this run the following commands:
.vimrc file using the following command:
Now append the following text in the above-opened file and then save the file:
Here you have successfully enabled syntax highlighting permanently in Vim.
Turn Off Syntax Highlighting in Vim
You can turn off syntax highlighting by using the following command inside Vim:
In this tutorial, you have learned How to Turn On Syntax Highlighting in Vim/Vi Editor. If You have any queries regarding this please comment below.