Programster's Blog

Tutorials focusing on Linux, programming, and open-source

VIM - Enable Syntax Highlighting

VIM

The default VIM installation in Debian 8 does not have syntax highlighting enabled by default. Other distributions may be the same. Running the BASH script below should enable syntax highlighting.

SEARCH='"syntax on'
REPLACE='syntax on'
FILEPATH="/etc/vim/vimrc"
sudo sed -i "s;$SEARCH;$REPLACE;" $FILEPATH

All the script does is uncomment the syntax on line as shown in the image below (which also shows you what VIM looks like when syntax highlighting is enabled).

If you find that you are getting error messages and no syntax highlighting at any point, make sure you are using vim.basic and not vim.tiny. Change your default editor with select-editor.

References

Last updated: 24th July 2021
First published: 16th August 2018