#### Vim syntax highlighting by default

##### May 3, 2015

Vim is an advanced text editor that enhances and is built upon the popular Unix editor “vi”. Vim is a short form for VI-improved, as in VImproved.

Syntax highlighting is efficiently integrated in Vim and one may tap into that power by visiting the full syntax documentation page.

Though, to be brief, enabling syntax highlight while you are already editing a file is straightforward; just shoot the command syntax on or syntax off to toggle.

To set the same as default, rather than having to hit the command every time after opening a file, it could be added to the ~/.vimrc file. In my config, I also add the “tabspace” setting. Vim comes with a tabspace of 8 characters which isn’t elegant when coding quick scripts. Python coders would reduce that to 4 spaces while I prefer reducing it to 2 spaces. Therefore, the vimrc file is edited as follows:

syntax on
setlocal tabstop=2
setlocal autoindent


Auto-indentation is another useful setting; which indents the next line following a curly bracket.