From 4db161487fc4b8058fc9c24b78fb7ace6a44f9d6 Mon Sep 17 00:00:00 2001 From: Dag Odenhall Date: Mon, 2 Apr 2012 15:38:27 +0200 Subject: [PATCH] :compiler cabal --- compiler/cabal.vim | 14 ++++++++++++++ doc/vim2hs.txt | 20 ++++++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 compiler/cabal.vim diff --git a/compiler/cabal.vim b/compiler/cabal.vim new file mode 100644 index 0000000..9734b2b --- /dev/null +++ b/compiler/cabal.vim @@ -0,0 +1,14 @@ +if exists('current_compiler') + finish +endif +let current_compiler = 'cabal' + +let s:errorformat = join([ + \ '%E%f:%l:%c:', + \ '%+C %m', + \ '%-Z%[%^ ]', + \ ], ',') +execute 'CompilerSet errorformat=' . escape(s:errorformat, ' ') + +CompilerSet makeprg=cabal\ build +CompilerSet shellpipe& diff --git a/doc/vim2hs.txt b/doc/vim2hs.txt index 0cfca36..e69aa7e 100644 --- a/doc/vim2hs.txt +++ b/doc/vim2hs.txt @@ -41,12 +41,32 @@ COMMANDS *vim2hs-commands* ============================================================================= COMPILERS *vim2hs-compilers* +All compilers shipped with vim2hs use |:CompilerSet| and as such can be +enabled globally using ":compiler!". Optionally you can use an |autocommand| +or |ftplugin| to enable a compiler only for Haskell buffers, for example: +> + autocmd FileType haskell compiler cabal +< *quickfix-hlint* *compiler-hlint* :compiler hlint Configure |:make| for using HLint. Requires hlint (available from Hackage) to be installed and in $PATH. See also |g:hlint_args|. + *quickfix-cabal* *compiler-cabal* +:compiler cabal Configure |:make| for using Cabal. Requires cabal + (available as cabal-install from Hackage) to be + installed and in $PATH. Runs "cabal build" which also + works with cabal-dev, but you have to install + dependencies and run configure first, for example by + running "cabal-dev install". + + Warnings from GHC will be parsed as errors due to + limitations of Vim's |errorformat| patterns and the + complexity of GHC's output. This might be resolved in + the future by filtering Cabal's output through a + script. + ============================================================================= TABULAR *vim2hs-tabular*