MoinMoin Wiki Syntax Highlighting for VI (VIM)


Regular readers of this blog can probably just stop right here. I’m using this entry as a way to get my new MoinMoin wiki syntax highlighting tool into google. What follows is only relevent the cross section of people that use both Trac and VI.

For those of you who do use trac, you’re probably aware of how difficult it is to edit large wiki pages. The reasons for this are manifold, but they start with the fact that you are constantly scrolling back and forth between the read-only, HTML-rendered version of the document and the editable, wiki-text version.

My first-pass solution to this was to simply copy/paste the wiki text into my editor of choice (vi a.k.a. vim a.k.a. gvim) . But this doesn’t address the problem since the lack of formatting and syntax highlighting reduces larger documents to a morass of mostly homogenous text. Finding the sections you want to work on is problematic.

To solve this, I put together a vi syntax file for highlighting MoinMoin formatted wiki text. You can get it here. For instructions on how to install it, do “:help new-filetype” and follow the steps in section C (“If your file type can be detected by the file name…”)

,

3 responses to “MoinMoin Wiki Syntax Highlighting for VI (VIM)”

  1. Hi,

    I get a “Forbidden” error accessing http://www.broofa.com/Tools/vim/syntax/moinmoin.vim

    I’m one of the maintainers of another Vim syntax file for MoinMoin (http://moinmoin.wikiwikiweb.de/VimHighlighting) and that’s where I first saw your announcement. I’d be interested in seeing if elements of your syntax file could be included.

    You might also be interested in using the Mozex or Editus Externus plugins for Firefox to edit wiki textareas in an external editor.

    David

  2. I’m using Vim 7.1 under Ubuntu and it didn’t like the ^M characters before the newlines. It seems the file is using \r\n for new lines? I did a ‘tr “\r” “\n” trac.vim’ which gave it extra spacing, but fixed the errors vim gave me.

    In any case, it worked after that, but I was disappointed to see it only has formatting for gui vim. Terminal vim doesn’t benefit from this file as is. I’ll just have to add a few of my own codes.

  3. Drew, sorry about that – I’ve fixed the ^M characters. By the way, you might find the following Bash function useful – it’s what I use to clean up ^M-tainted files:
    cleanse () {
    for i in $*; do
    tr -d ‘\r’ < "$i" >“$i.cleanse”;
    mv “$i.cleanse” “$i”;
    done
    }