10

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?

Seth
  • 484
  • 4
  • 20
One Face
  • 243
  • 1
  • 6
  • Check out this question: http://vi.stackexchange.com/questions/3882/change-default-syntax-highlighting-scheme – ankush981 Jul 10 '15 at 09:41

2 Answers2

10

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.

johannes
  • 589
  • 3
  • 7
8

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.

romainl
  • 40,486
  • 5
  • 85
  • 117