literate haskell syntax highlighting issues in vim (Re:[Haskell-cafe] OK, so this VIM thing -- how do I make it actually work?)

Claus Reinke claus.reinke at
Tue Jun 5 10:25:13 EDT 2007

the following sequence seems to help (tested on ghc/compiler/stranal/StrictAnal.lhs):

:syn sync fromstart
:syn region texZone matchgroup=hsLineComment start="\\begin{code}" end="\\end{code}" 
contains=@haskellTop keepend matchgroup=NONE

i'll leave it to those who are actually using literate haskell to
check this and to have it included in lhaskell.vim if it is helpful.


----- Original Message ----- 
From: "Claus Reinke" <claus.reinke at>
To: <haskell-cafe at>
Sent: Tuesday, June 05, 2007 1:28 PM
Subject: literate haskell syntax highlighting issues in vim (Re:[Haskell-cafe] OK,so this VIM 
thing -- how do I make it actually work?)

>>>    clearly.)  The problems I'm seeing are the ugly white-on-red for
>>>    underlines, the lack of any kind of differentiation for
>> You can also put your cursor an those underlines and use
>>  :echo synIDattr(synID(line("."), col("."), 1), "name")
> looks like a highlighting bug alright. reduced example:
> ------------------------ H.lhs:
> % \section{one}
> \begin{code}
> data D_e = D String deriving Show
> \end{code}
> % \section{two}
> data D_e = D String deriving Show
> ------------------------ 
> as it is, the first code line is haskell-highlighted, the "_" is part of a "ConId"; the second 
> code line is tex-highlighted, the "_" becomes a "texOnlyMath", and is highlighted as a syntax 
> error (red).
> if i uncomment the "\section{one}", haskell-highlighting disappears,
> everything is now part of a "texSectionZone", and highlighted as
> such, including tex syntax error highlights.
> if i now register code-sections as "texZone" (the zone "tex.vim" uses for "verbatim"), with 
> haskell contents, both code lines are
> haskell-highlighted, so the "texSectionZone" has been interrupted..
> :syn region texZone start="\\begin{code}" end="\\end{code}" contains=@haskellTop
> if i now uncomment the "\section{two}", a new "texSectionZone"
> is started there (might need a resync), and both code lines are highlighted correctly (the first 
> as haskell, the second as -buggy- tex).
> "tex.vim" has several zones with no real end marker ("\section",
> "\chapter", ..), and it seems that "tex.vim" and "lhaskell.vim" do
> not interact properly.
> since this list is given as the maintainer for "lhaskell.vim": any literate haskellers out here 
> who'd like to try fixing that?-)
> claus
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at

More information about the Haskell-Cafe mailing list