However, it seemingly highlights it with the function name in a same way.
With :echo synIDattr(synID(line('.'), col('.'), 1), 'name') we can get the
name of the syntax group, which is indeed pythonFunction.
Looking at /usr/share/vim/vim80/syntax/python.vim we can see this is
highlighted with:
syn keyword pythonStatement class def nextgroup=pythonFunction skipwhite
syn match pythonFunction "\h\w*" display contained
hi def link pythonFunction Function
There is no facility to highlight classes separately. If you want to add this,
you can use something like:
" Clear default
syn clear pythonStatement
" Set it to what's in the Python file, minus the class.
syn keyword pythonStatement False None True
syn keyword pythonStatement as assert break continue del exec global
syn keyword pythonStatement lambda nonlocal pass print return with yield
syn keyword pythonStatement def nextgroup=pythonFunction skipwhite
" Now make seperate syntax groups for the class.
syn keyword pythonClassStmt class nextgroup=pythonClass skipwhite
syn match pythonClass "\h\w*" display contained
" Avoid highlighting attributes as builtins – just added "pythonClass" here.
syn clear pythonAttribute
syn match pythonAttribute /\.\h\w*/hs=s+1
\ contains=ALLBUT,pythonBuiltin,pythonFunction,pythonClass,pythonAsync
\ transparent
" Highlight the class statement and the class name.
hi def link pythonClassStmt Statement
hi pythonClass ctermfg=darkgreen guifg=darkgreen
I used darkgreen because this is what Ruby uses, but feel free to use any colour
you like. You could highlight the class keyword any way you'd like.
To make this loads after the built-in Python syntax file add this to
~/.vim/after/syntax/python.vim.
Also see: Fixing “missing” syntax highlighting for python
for a general primer on syntax highlighting and some more details.
syntax onin your vimrc. If it is highlighted but you want to change the highlighting, see:h mysyntaxfile-addto know how to override the current syntax highlighting file. In any case you should be more specific with what you already tried (which command, in which file, etc). – statox Dec 12 '16 at 14:37