When I write a script in gedit, the commands, comments, variables etc... are given different colors. How do I setup vim to do the same?


2 Answers 2


vim has an extensive support for syntax highlighting and typical distributions contain a number of highlighting rules. For enabling this you have to switch the syntax module on using :syntax on in your vim session or globally your .vimrc file.

See vim help on syntax for details.


Try :syntax on.

To have syntax highlighting enabled by default, add the following line to your ~/.vimrc:

syntax on

If the file doesn't exist, create it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.