summaryrefslogtreecommitdiff
path: root/.vim/autoload/haskellmode.vim
diff options
context:
space:
mode:
Diffstat (limited to '.vim/autoload/haskellmode.vim')
-rw-r--r--.vim/autoload/haskellmode.vim40
1 files changed, 38 insertions, 2 deletions
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 <claus.reinke@talk21.com>
@@ -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
+