I would like an object method call to be syntax highlighted in Vim. For instance, in an expression that contains person.getName()
, I would like to match getName
and give it some syntax highlighting.
I have tried quite a number of patterns and at the moment, this is what I have in my experimental syntax file;
" :set iskeyword+=.
syntax match myMatch "\v\.\zs\w+\ze\("
highlight link myMatch Function
It is not highlighting unless I comment in the first line above or issue :set iskeyword+=.
manually and then try editing the file.
How can I make the highlighting successful without having to set .
as part of iskeyword
??
UPDATE: I have Pathogen and I have the file with the contents above in ~/.vim/bundle/vim-javascript-syn/syntax/javascript.vim
javascript.vim
, notjavascript.js
, or? 2) put the two lines in the file~/.vim/after/syntax/javascript.vim
and test again. (see:help after-directory
).vim
. My mistake. It's not.js
. Updated question. @Ralf