From c7c03a0185ac4598331bf88eea1ccd0bc62b87d5 Mon Sep 17 00:00:00 2001 From: René Neumann Date: Fri, 9 Dec 2011 16:29:52 +0100 Subject: Update haskellmode --- .vim/autoload/haskellmode.vim | 40 ++++++++++++++++++++++++++++++++++++++-- 1 file changed, 38 insertions(+), 2 deletions(-) (limited to '.vim/autoload/haskellmode.vim') diff --git a/.vim/autoload/haskellmode.vim b/.vim/autoload/haskellmode.vim index ce20a67..4a26cd5 100644 --- a/.vim/autoload/haskellmode.vim +++ b/.vim/autoload/haskellmode.vim @@ -1,7 +1,7 @@ " " utility functions for haskellmode plugins " -" (Claus Reinke; last modified: 23/04/2009) +" (Claus Reinke; last modified: 22/06/2010) " " part of haskell plugins: http://projects.haskell.org/haskellmode-vim " please send patches to @@ -63,7 +63,7 @@ function! haskellmode#GatherImports() let res = haskellmode#GatherImport(i) if !empty(res) let [i,import] = res - let prefixPat = '^import\s*\(qualified\)\?\s\+' + let prefixPat = '^import\s*\%({-#\s*SOURCE\s*#-}\)\?\(qualified\)\?\s\+' let modulePat = '\([A-Z][a-zA-Z0-9_''.]*\)' let asPat = '\(\s\+as\s\+'.modulePat.'\)\?' let hidingPat = '\(\s\+hiding\s*\((.*)\)\)\?' @@ -153,3 +153,39 @@ function! haskellmode#UrlEncode(string) return url endfunction +" TODO: we could have buffer-local settings, at the expense of +" reconfiguring for every new buffer.. do we want to? +function! haskellmode#GHC() + if (!exists("g:ghc") || !executable(g:ghc)) + if !executable('ghc') + echoerr s:scriptname.": can't find ghc. please set g:ghc, or extend $PATH" + return 0 + else + let g:ghc = 'ghc' + endif + endif + return 1 +endfunction + +function! haskellmode#GHC_Version() + if !exists("g:ghc_version") + let g:ghc_version = substitute(system(g:ghc . ' --numeric-version'),'\n','','') + endif + return g:ghc_version +endfunction + +function! haskellmode#GHC_VersionGE(target) + let current = split(haskellmode#GHC_Version(), '\.' ) + let target = a:target + for i in current + if ((target==[]) || (i>target[0])) + return 1 + elseif (i==target[0]) + let target = target[1:] + else + return 0 + endif + endfor + return 1 +endfunction + -- cgit v1.2.3-70-g09d2