Skip to content

Commit 434fe24

Browse files
committed
#83 add alternative case indentation
1 parent 962d39f commit 434fe24

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

README.md

+7
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,13 @@ To configure indentation in `haskell-vim` you can use the following variables to
100100
f x y
101101
>>|
102102

103+
`haskell-vim` also supports an alterative style for `case` indentation.
104+
105+
* `let g:haskell_indent_case_alternative = 1`
106+
107+
f xs ys = case xs of
108+
>>[] -> ...
109+
>>(y:ys) -> ...
103110

104111

105112
#### Cabal

indent/haskell.vim

+5-1
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,11 @@ function! GetHaskellIndent()
268268
" case foo of
269269
" >>bar -> quux
270270
if l:prevline =~ '\C\<case\>.\+\<of\>\s*$'
271-
return match(l:prevline, '\C\<case\>') + g:haskell_indent_case
271+
if exists('g:haskell_indent_case_alternative') && g:haskell_indent_case_alternative
272+
return match(l:prevline, '\S') + &shiftwidth
273+
else
274+
return match(l:prevline, '\C\<case\>') + g:haskell_indent_case
275+
endif
272276
endif
273277

274278
"" where foo

0 commit comments

Comments
 (0)