Reputation: 11
I have a vimrc file
" activates filetype detection
filetype plugin indent on
" activates syntax highlighting among other things
syntax on
set autoindent
colorscheme default
highlight Comment ctermfg=DarkGreen
syntax match dollar "/\$\w*"
highlight dollar ctermfg=magenta
And i want all words with a $
in magenta... But when I open a file, all words with $
are in yellow...
And when i try to test the regex with just :/\$\w*
, all $word
are selected... So I don't understand why highlighting is not OK...
Upvotes: 1
Views: 289
Reputation: 196751
In:
:syntax match {group-name} {pattern}
<pattern>
is a pattern, not a search command, so you should drop the /
from:
syntax match dollar "/\$\w*"
in order to get:
syntax match dollar "\$\w*"
which works as expected:
Upvotes: 1