Skip to content

Commit 8be1c40

Browse files
committed
Use shiftwidth() to shift to tabstop when 0
shiftwidth() the function "was introduced with patch 7.3.694 in 2012; everybody should have it by now," says the vim documentation.
1 parent b1ac468 commit 8be1c40

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

indent/haskell.vim

+14-14
Original file line numberDiff line numberDiff line change
@@ -189,13 +189,13 @@ function! GetHaskellIndent()
189189

190190
" operator at end of previous line
191191
if l:prevline =~ '[!#$%&*+./<>?@\\^|~-]\s*$'
192-
return indent(v:lnum - 1) + &shiftwidth
192+
return indent(v:lnum - 1) + shiftwidth()
193193
endif
194194

195195
" let foo =
196196
" >>>>>>bar
197197
if l:prevline =~ '\C\<let\>\s\+[^=]\+=\s*$'
198-
return match(l:prevline, '\C\<let\>') + g:haskell_indent_let + &shiftwidth
198+
return match(l:prevline, '\C\<let\>') + g:haskell_indent_let + shiftwidth()
199199
endif
200200

201201
" let x = 1 in
@@ -243,7 +243,7 @@ function! GetHaskellIndent()
243243
" >>foo
244244
"
245245
if l:prevline =~ '\C\<where\>\s*$'
246-
return indent(v:lnum - 1) + get(g:, 'haskell_indent_after_bare_where', &shiftwidth)
246+
return indent(v:lnum - 1) + get(g:, 'haskell_indent_after_bare_where', shiftwidth())
247247
endif
248248

249249
" do
@@ -252,7 +252,7 @@ function! GetHaskellIndent()
252252
" foo =
253253
" >>bar
254254
if l:prevline =~ '\C\(\<do\>\|=\)\s*$'
255-
return indent(v:lnum - 1) + &shiftwidth
255+
return indent(v:lnum - 1) + shiftwidth()
256256
endif
257257

258258
" do foo
@@ -268,7 +268,7 @@ function! GetHaskellIndent()
268268
" >>bar -> quux
269269
if l:prevline =~ '\C\<case\>.\+\<of\>\s*$'
270270
if get(g:,'haskell_indent_case_alternative', 0)
271-
return indent(v:lnum - 1) + &shiftwidth
271+
return indent(v:lnum - 1) + shiftwidth()
272272
else
273273
return match(l:prevline, '\C\<case\>') + g:haskell_indent_case
274274
endif
@@ -301,7 +301,7 @@ function! GetHaskellIndent()
301301
" newtype Foo = Foo
302302
" >>deriving
303303
if l:prevline =~ '\C^\s*\<\(newtype\|data\)\>[^{]\+' && l:line =~ '\C^\s*\<deriving\>'
304-
return indent(v:lnum - 1) + &shiftwidth
304+
return indent(v:lnum - 1) + shiftwidth()
305305
endif
306306

307307
" foo :: Int
@@ -314,7 +314,7 @@ function! GetHaskellIndent()
314314
if l:line =~ '^\s*[-=]>'
315315
return match(l:prevline, '::\s')
316316
elseif match(l:prevline, '^\s\+::') > -1
317-
return match(l:prevline, '::\s') - &shiftwidth
317+
return match(l:prevline, '::\s') - shiftwidth()
318318
endif
319319
endif
320320

@@ -394,21 +394,21 @@ function! GetHaskellIndent()
394394
">>>>>=> Int
395395
if l:prevline =~ '^\s*)' && l:line =~ '^\s*=>'
396396
let l:s = match(l:prevline, ')')
397-
return l:s - (&shiftwidth + 1)
397+
return l:s - (shiftwidth() + 1)
398398
endif
399399

400400
" module Foo
401401
" >>( bar
402402
if l:prevline =~ '\C^\<module\>'
403-
return &shiftwidth
403+
return shiftwidth()
404404
endif
405405

406406
" foo
407407
" >>{
408408
if l:line =~ '^\s*{'
409409
let l:s = indent(v:lnum - 1)
410410
if l:s >= 0
411-
return l:s + &shiftwidth
411+
return l:s + shiftwidth()
412412
endif
413413
endif
414414

@@ -424,7 +424,7 @@ function! GetHaskellIndent()
424424
return match(l:prevline, 'in') - g:haskell_indent_in
425425
endif
426426

427-
return indent(v:lnum - 1) + get(g:, 'haskell_indent_before_where', &shiftwidth)
427+
return indent(v:lnum - 1) + get(g:, 'haskell_indent_before_where', shiftwidth())
428428
endif
429429

430430
" let x = 1
@@ -458,13 +458,13 @@ function! GetHaskellIndent()
458458
" >>=
459459
if l:line =~ '^\s*='
460460
if l:prevline =~ '\C^\<data\>\s\+[^=]\+\s*$'
461-
return match(l:prevline, '\C\<data\>') + &shiftwidth
461+
return match(l:prevline, '\C\<data\>') + shiftwidth()
462462
else
463463
let l:s = s:indentGuard(match(l:line, '='), l:prevline)
464464
if l:s > 0
465465
return l:s
466466
else
467-
return &shiftwidth
467+
return shiftwidth()
468468
endif
469469
endif
470470
endif
@@ -489,7 +489,7 @@ function! GetHaskellIndent()
489489
" foo
490490
" >>:: Int
491491
if l:line =~ '^\s*::\s'
492-
return indent(v:lnum - 1) + &shiftwidth
492+
return indent(v:lnum - 1) + shiftwidth()
493493
endif
494494

495495
" indent closing brace, paren or bracket

0 commit comments

Comments
 (0)