[Haskell-cafe] Re: OK, so this VIM thing -- how do I make it actually work?

Paul Moore p.f.moore at gmail.com
Tue Jun 5 09:50:21 EDT 2007

On 05/06/07, Michael T. Richter <ttmrichter at gmail.com> wrote:
> Oops.  I spoke too soon.  It works ... for about a third of the file.  It
> then loses its mind in the middle of a do-block (in a sizable chunk of code)
> and doesn't regain it until the next code begin/end pairing ends.

There is a fix for this (:syn sync fromstart is the usual incantation that
helps) but (as a Vim user) I take your point that Vim's highlighting is not
as you want it out of the box, and that matters.

 So, I guess I'm back to my original question: where can I find a decent
> editor that can do syntax highlighting out of the box for literate Haskell?
> (Or, alternatively, where can I find a syntax-highlighting editor I can
> expand the syntax handling of on my own?)  VIM is broken out of the box and
> if I'm going to mess around with syntax highlighting files, I'd at least
> like to do it in an editor I'm likely to be comfortable in.

You need to take into account the fact that highlighting literate Haskell is
hard, if you want it done completely right, because there are two entirely
distinct sets of syntax (Haskell and LaTeX) being interspersed (and from the
look of one of your examples, you use CPP syntax in places as well). That is
never going to be easy to handle. If you were happy with the LaTeX being
left unhighlighted, it wouldn't be too hard to handle. Equally, if you want
the LaTeX highlighting with the Haskell unhighlighted, that's easy enough as
well. It's the combination that's hard.

So, you should probably:

1. Accept that you're going to have very few, if any, good options
2. Think about your priorities - if you have to give something up, what
would hurt you least? (FWIW, if you're happy for the LaTeX to be left
unhighlighted, setting lhs_markup="none" in Vim might be enough for you).

Beyond that, I can't offer any suggestions - I use Vim and am happy with it,
but I know it's limited when dealing with mixed-type files (HTML + CSS +
JavaScript is another common case).

Hope this helps,
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20070605/004b9ef0/attachment.htm

More information about the Haskell-Cafe mailing list