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?
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
See vim help on syntax for details.