Monday, June 29, 2015

syntax region end when either pattern occurs?

I am trying to syntax highlight yaml blocks in Markdown files.

Right now, I can get it so it handles either blocks that look like this:

---
author: me
document: Help
---

or

---
author: me
document: Help
...

But not both. Is there a way to do both?

I tried end=\(/^---$/\|/^\.\.\.$\) but that didn't work

unlet b:current_syntax

" Bring in YAML syntax for front matter
syntax include @Yaml syntax/yaml.vim

syntax region yamlFrontmatter start=/\%^---$/ end=/^---$/ keepend contains=@Yaml
syntax region yamlFrontmatter start=/\%^---$/ end=/^\.\.\.$/ keepend contains=@Yaml

let b:current_syntax='markdown'

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment