Monday, September 6, 2010

Haskell mode in MacVim

I set up Haskell mode (haskellmode-20100622.vba) in MacVim 7.3 (53). As a Vim newbie I found this page useful, even though it says pretty much the same thing as the Haskell mode project page.

I followed the instructions and created $HOME/.vimrc with these contents.

" use ghc functionality for haskell files
au Bufenter *.hs compiler ghc

" switch on syntax highlighting
set syntax on

" enable filetype detection, plus loading of filetype plugins
set filetype plugin on

" Configure browser for haskell_doc.vim
let g:haddock_browser = "open"
let g:haddock_browser_callformat = "%s %s"
Unfortunately when I edited a Haskell file none of the Haddock integration was working. I assume the haskell_doc.vim filetype plugin wasn't being loaded because the :DocSettings command failed with E492: Not an editor command.

After some hours I changed the line set filetype plugin on to :filetype plugin on and Haddock integration now works (don't know why). I am using the Haskell Platform which includes the documentation.

After reading A minimal Vim configuration I have switched from $HOME/.vimrc to $HOME/.gvimrc with these contents.
" line numbers
set number

" show the cursor line and column number
set ruler

" turn off blinking cursor in normal mode
set gcr=n:blinkon0

" hide the toolbar
set go-=T

" switch on syntax highlighting
set syntax

" highlight matches in a search (hls)
" show the current matching pattern as you search (is),
" ignore case (ic) unless you are searching for both upper and lowercase letters (scs)
set hls is ic scs

" use ghc functionality for haskell files
au Bufenter *.hs compiler ghc

" enable filetype detection, plus loading of filetype plugins
:filetype plugin indent on

" Configure browser for haskell_doc.vim
let g:haddock_browser = "open"
let g:haddock_browser_callformat = "%s %s"

No comments: