Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Vim :colorscheme on Python

I'm using Mac OSX Lion 10.7.2, Terminal.app supports 256 (output of :echo &t_Co). In my vimrc I have (PATH/TO/vim/vimrc)

syntax on
filetype plugin indent on
set nobackup

When I "vim blah.py" and :colorscheme torte, syntax colors are not loading. For example python keyword doesn't have a proper colors (They have regular text color). That works for .c files but not python.

I updated my syntax/python.vim but still no luck.

Can someone tell me why?

like image 979
markfw Avatar asked Oct 28 '11 05:10

markfw


2 Answers

markfw

Your answer is very good but let me just add one thing to it. In your .vimrc instead of adding just

let python_highlight_all=1

you should add it this way

autocmd BufRead,BufNewFile *.py let python_highlight_all=1

This way it only applies to Python file(s).

Hope this help.

like image 103
Orion Avatar answered Sep 21 '22 15:09

Orion


if it works in c but not on py, the filetype file and/or syntax file is not at the right location for python.

vim manual should help you, but I also would try :scr command. This lists all the vim script loaded. So you start vim in two different way

vim your.c

vim your.py

and then in each vim session, type :scr. see how the syntax file for C is loaded (it is like chain reaction), and why it doesnt work that way for python may give you clue.

like image 24
yosukesabai Avatar answered Sep 18 '22 15:09

yosukesabai