Skip to content

Commit e637c49

Browse files
author
Coot
authored
Indentation (#41)
* fix #39: indentation of do * fix #34: indent rules for lambdas & case expressions
1 parent 20dbff5 commit e637c49

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

indent/purescript.vim

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -122,14 +122,12 @@ function! GetPurescriptIndent()
122122

123123
" indent rules for -> (lambdas and case expressions)
124124
let s = match(line, '->')
125+
let p = match(prevline, '\\')
125126
" protect that we are not in a type signature
127+
" and not in a case expression
126128
if s >= 0 && index(s:GetSynStack(s == 0 ? v:lnum - 1 : v:lnum, max([1, s])), "purescriptFunctionDecl") == -1
127-
let p = match(prevline, '\\')
128-
if p >= 0 && index(s:GetSynStack(v:lnum - 1, p), "purescriptString") == -1
129-
return p
130-
else
131-
return match(prevline, '\S') + &l:shiftwidth
132-
endif
129+
\ && p >= 0 && index(s:GetSynStack(v:lnum - 1, p), "purescriptString") == -1
130+
return p
133131
endif
134132

135133
if prevline =~ '^\S'
@@ -236,7 +234,7 @@ function! GetPurescriptIndent()
236234

237235
let s = match(prevline, '\<do\>\s*$')
238236
if s >= 0 && index(s:GetSynStack(v:lnum - 1, s), 'purescriptString') == -1
239-
return s + g:purescript_indent_do
237+
return match(prevline, '\S') + g:purescript_indent_do
240238
endif
241239

242240
let s = match(prevline, '\<do\>\s\+\zs\S\+.*$')

0 commit comments

Comments
 (0)