Vim :colorscheme on Python


I'm using Mac OSX Lion 10.7.2, 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" 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?

5/19/2018 10:51:52 AM

Accepted Answer


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.

1/4/2013 4:45:32 AM

The way that I made it to work (I'm using Terminal) is to have let python_highlight_all = 1 in my ~/.vimrc file and now everything works fine and all objects such as list, tuple, ... are colored.

For more information please look at the syntax/python.vim.

Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow