Reputation: 4017
I'm coding a syntax file for my todos with Vim Actually i highlight the lines when they begin with w:,h: or p: like this :
syn match todoHome "^h: "
syn match todoWork "^w: "
syn match todoPersonal "^p: "
syn region todoHome start=/^h: / end=/\n/
syn region todoWork start=/^w: / end=/\n/
syn region todoPersonal start=/^p: / end=/\n/
syn region todoDone start=/^x: / end=/\n/
I would like to create some subtask with tabs and highlight it in the same way... I know regex can do that, i tried :
syn region todoWork start=/^|[\t ]+w: / end=/\n/
But it not works... Any clue ?
Upvotes: 0
Views: 859
Reputation: 161884
|
=> \|
:help pattern
1. A pattern is one or more branches, separated by "\|". It matches anything
that matches one of the branches. Example: "foo\|beep" matches "foo" and
matches "beep". If more than one branch matches, the first one is used.
pattern ::= branch
or branch \| branch
or branch \| branch \| branch
etc.
+
=> \+
\+ 1 or more as many as possible (*)
\v
at the beginning of the pattern!Use of "\v" means that in the pattern after it all ASCII characters except
'0'-'9', 'a'-'z', 'A'-'Z' and '_' have a special meaning. "very magic"
Upvotes: 2