I am using molokai in vim to code in python/html/css/javascript. When I edit python files (or javascript) parenthesis are not colored. This is not true for simple scripts (like molokai.vim itself) where parenthesis are colored gray.
I edited molokai.vim and added
hi parens guifg=#999999
and then I edited .vimrc and added:
syn match parens /[(){}]/
but parenthesis and brackets remain white.
What am I doing wrong?
:synto highlight all filetypes, there ismatchadd()for this. Using:syncan easily break highlighting,matchadd()is an overlay.Syntax highlighting is being overridden when
Syntaxevent fires. More, it has effect only on the current buffer. So justsynin vimrc will never work, you have to use autocommands(for python it is safe as parenthesis and figure brackets are not matched by any other syntax element).
In javascript parenthesis (
()) are already matched byjavaScriptParenshighlighting group. Thus you have to use(in colorscheme). Braces are matched by
javaScriptBracesand require similar command.To determine what highlighting is used for specific symbol I place cursor on this symbol and launch
, the last displayed word is normally what you need. If only
Normalis displayed then symbol is not highlighted and you have to go 2., otherwise you have to go 3.For universal solution disregarding currently used highlighting you may use
matchadd()as I already said. But it is local to window so if you are working with multiple windows/tabs you can’t go without autocmd:All autocommands are to be surrounded with