summaryrefslogtreecommitdiffstats
path: root/indent/haskell.vim
diff options
context:
space:
mode:
Diffstat (limited to 'indent/haskell.vim')
-rw-r--r--indent/haskell.vim24
1 files changed, 19 insertions, 5 deletions
diff --git a/indent/haskell.vim b/indent/haskell.vim
index ebdab5e7..fa2ee7cf 100644
--- a/indent/haskell.vim
+++ b/indent/haskell.vim
@@ -15,6 +15,10 @@ endif
let b:did_indent = 1
+if !exists('g:haskell_indent_disable')
+ let g:haskell_indent_disable = 0
+endif
+
if !exists('g:haskell_indent_if')
" if x
" >>>then ...
@@ -59,8 +63,14 @@ if !exists('g:haskell_indent_guard')
let g:haskell_indent_guard = 2
endif
-setlocal indentexpr=GetHaskellIndent()
-setlocal indentkeys=0{,0},0(,0),0[,0],!^F,o,O,0\=,0=where,0=let,0=deriving,<space>
+if exists("g:haskell_indent_disable") && g:haskell_indent_disable == 0
+ setlocal indentexpr=GetHaskellIndent()
+ setlocal indentkeys=0{,0},0(,0),0[,0],!^F,o,O,0\=,0=where,0=let,0=deriving,<space>
+else
+ setlocal nocindent
+ setlocal nosmartindent
+ setlocal autoindent
+endif
function! s:isInBlock(hlstack)
return index(a:hlstack, 'haskellParens') > -1 || index(a:hlstack, 'haskellBrackets') > -1 || index(a:hlstack, 'haskellBlock') > -1 || index(a:hlstack, 'haskellBlockComment') > -1 || index(a:hlstack, 'haskellPragma') > -1
@@ -270,7 +280,11 @@ function! GetHaskellIndent()
" case foo of
" >>bar -> quux
if l:prevline =~ '\C\<case\>.\+\<of\>\s*$'
- return match(l:prevline, '\C\<case\>') + g:haskell_indent_case
+ if exists('g:haskell_indent_case_alternative') && g:haskell_indent_case_alternative
+ return match(l:prevline, '\S') + &shiftwidth
+ else
+ return match(l:prevline, '\C\<case\>') + g:haskell_indent_case
+ endif
endif
"" where foo
@@ -324,8 +338,8 @@ function! GetHaskellIndent()
while v:lnum != l:c
" fun decl
- let l:s = match(l:l, l:m)
- if l:s >= 0
+ if l:l =~ ('^\s*' . l:m . '\(\s*::\|\n\s\+::\)')
+ let l:s = match(l:l, l:m)
if match(l:l, '\C^\s*\<default\>') > -1
return l:s - 8
else