diff options
author | Adam Stankiewicz <sheerun@sher.pl> | 2016-12-20 20:57:20 +0100 |
---|---|---|
committer | Adam Stankiewicz <sheerun@sher.pl> | 2016-12-20 20:57:20 +0100 |
commit | e404a658b1647fad396a954776eda0bdabf8353c (patch) | |
tree | fcdab0e324fd72015ba656e43bd8f8c243030c14 /indent/haskell.vim | |
parent | 74652b465d7eff97070001317a4ea5557717378d (diff) | |
download | vim-polyglot-e404a658b1647fad396a954776eda0bdabf8353c.tar.gz vim-polyglot-e404a658b1647fad396a954776eda0bdabf8353c.zip |
Update
Diffstat (limited to 'indent/haskell.vim')
-rw-r--r-- | indent/haskell.vim | 24 |
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 |