Skip to content

Commit f469efb

Browse files
committed
fix :: pattern to consider comments
1 parent 0206921 commit f469efb

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

indent/haskell.vim

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
" Filename: indent/haskell.vim
33
" Author: itchyny
44
" License: MIT License
5-
" Last Change: 2025/03/03 09:45:31.
5+
" Last Change: 2025/04/15 08:09:38.
66
" =============================================================================
77

88
if exists('b:did_indent')
@@ -76,16 +76,16 @@ function! GetHaskellIndent() abort
7676
endif
7777

7878
" =
79+
if line =~# '\v^\s*\='
80+
return s:indent_eq()
81+
endif
82+
7983
if line =~# '\v\='
8084
if getline(v:lnum - 1) =~# '\v^\s*-\>'
8185
return indent(v:lnum - 1) - &shiftwidth
8286
endif
8387
endif
8488

85-
if line =~# '\v^\s*\='
86-
return s:indent_eq()
87-
endif
88-
8989
" }, ], )
9090
if line =~# '\v^\s*[})\]]'
9191
return s:indent_parenthesis()
@@ -275,6 +275,11 @@ function! GetHaskellIndent() abort
275275
return s:indent('', '\v^\s*\zs.*<let>', 0, -1)
276276
endif
277277

278+
" ::
279+
if nonblankline =~# '\v::\s*%(--.*)?$'
280+
return indent(v:lnum - 1) + &shiftwidth
281+
endif
282+
278283
if nonblankline =~# '::'
279284
return s:indent('', nonblankline =~# '\v,\s*%(--.*)?$' ? '\S' : '\v\{\s*\<\w+\s*::', 0, match(nonblankline, '\S'))
280285
endif

0 commit comments

Comments
 (0)