How to enable syntax highlighting in Vim or Vi editor
Enable syntax highlighting in Vim / Vi Editor
Vim is one of the popular text editors for software developers and system administrators. macOS and various Linux Distros Vim are pre-installed. You can easily edit the code with Vim. However, Vim does not highlight syntax by default. In this tutorial, you will learn how to enable syntax highlighting in Vim / Vi Editor.
Enable syntax highlighting in Vim
helloworld.c Create the file using the following command: (I shot it here
helloworld.c You can open any program file as a demo file. )
EscKey to switch to normal mode if you are in another mode.
Enter the following command and hit
The output looks like this:
How to turn on syntax highlighting in the Vim editor-syntax highlighting
Turn on syntax highlighting permanently in Vim
Edit allows you to set syntax highlighting permanently
~/.vimrc File. To do this, run the following command:
.vimrc File using the following command:
Next, add the following text to the file opened above and save the file.
Now you have permanently enabled syntax highlighting in Vim.
Turn off syntax highlighting in Vim
You can turn off syntax highlighting using the following command within Vim:
In this tutorial, you learned how to enable syntax highlighting in Vim / Vi Editor. If you have any questions about this, please comment below.