vim and building with cabal
Posted on 29 July 2009
I don't know about you, but I've got
map ,m :make<Enter>
in my .vimrc to bind comma-m to my build program. This could be "ant" for Java files (for example) and "make" otherwise.
Now here is a snippet to set it to "cabal build" as needed
"-----------------------8<--------------------------
function! SetToCabalBuild()
if glob("*.cabal") != ''
set makeprg=cabal\ build
endif
endfunction
autocmd BufEnter *.hs,*.lhs :call SetToCabalBuild()
"-----------------------8<--------------------------
Apologies for making noise in case this is already redundant with a piece of Claus Reinke's very interesting and modular-looking
Haskell mode for Vim (which I've been promising myself to install some day). Perhaps the above will be useful anyway for those of us still limping along with configuration files cobbled together from bits and bobs on the web.