Vim syntax highlighting: make region only match on one line

Posted by sixtyfootersdude on Stack Overflow See other posts from Stack Overflow or by sixtyfootersdude
Published on 2010-03-17T13:08:04Z Indexed on 2010/03/17 13:11 UTC
Read the original article Hit count: 383

Filed under:
|

Hello

I have defined a custom file type with these lines:

syn region SubSubtitle start=+=+ end=+=+
highlight SubSubtitle ctermbg=black ctermfg=DarkGrey

syn region Subtitle start=+==+ end=+==+
highlight Subtitle ctermbg=black ctermfg=DarkMagenta

syn region Title start=+===+ end=+===+
highlight Title ctermbg=black ctermfg=yellow

syn region MasterTitle start=+====+ end=+====+
highlight MasterTitle cterm=bold term=bold ctermbg=black ctermfg=LightBlue

I enclose all of my headings in this kind of document like this:

==== Biggest Heading ==== // this will be bold and light blue

  ===Sub heading === // this will be yellow 

    bla bla bla  // this will be normally formatted

However right now when ever I use an equals sign in my code it thinks that it is a title. Is there anyway that I can force a match to be only on one line?

© Stack Overflow or respective owner

Related posts about vim

Related posts about unix