10

I was wondering how can I get this colorful syntax highlighting in vim on my Mac. I didn't add any libraries on my ubuntu desktop to get the syntax as shown in the image. Is it possible to get this behavior on Mac as well?

python syntax on ubuntu

smci
  • 32,567
  • 20
  • 113
  • 146
KKa
  • 408
  • 4
  • 19

2 Answers2

16

In Mac OSX edit your .vimrc file:

vi ~/.vimrc

and add the following:

filetype plugin indent on
syntax on

Save and close (:x) and try opening your python file again.

Ewan
  • 14,592
  • 6
  • 48
  • 62
0

It is not clear what you are referring to. If you are using a text editor in your terminal such as vim, then there is probably a plugin you can install to enable syntax highlighting. If you just want to style a Python file, then you might want to check out pygments

See also:

Alternatively, you might want to try out iPython

Community
  • 1
  • 1
Mike Driscoll
  • 32,629
  • 8
  • 45
  • 88