@@ -30,7 +30,7 @@ function! s:SyntaxMatch(pattern, line, col)
30
30
endfunction
31
31
32
32
function ! s: IgnoredRegion ()
33
- return s: SyntaxMatch (' \(string\|regex\|comment\|character\)' , line (' .' ), col (' .' ))
33
+ return s: SyntaxMatch (' \% (string\|regex\|comment\|character\)' , line (' .' ), col (' .' ))
34
34
endfunction
35
35
36
36
function ! s: NotStringDelimiter ()
@@ -72,6 +72,19 @@ function! s:GetStringIndent(delim_pos, regex)
72
72
endif
73
73
endfunction
74
74
75
+ function ! s: GetListIndent (delim_pos)
76
+ " TODO Begin analysis and apply rules!
77
+ let ln1 = getline (delim_pos[0 ])
78
+ let sym = get (split (ln1[delim_pos[1 ]:], ' [[:space:],;()\[\]{}@\\"^~`]' , 1 ), 0 , -1 )
79
+ if sym != -1 && ! empty (sym) && match (sym, ' ^[0-9:]' ) == -1
80
+ " TODO: align indentation.
81
+ return delim_pos[1 ] + 1 " 2 space indentation
82
+ endif
83
+
84
+ " TODO: switch between 1 vs 2 space indentation.
85
+ return delim_pos[1 ] " 1 space indentation
86
+ endfunction
87
+
75
88
" Wrapper around "searchpairpos" that will automatically set "s:best_match" to
76
89
" the closest pair match and optimises the "stopline" value for later
77
90
" searches. This results in a significant performance gain by reducing the
@@ -142,9 +155,7 @@ function! s:GetClojureIndent()
142
155
return 0
143
156
elseif formtype == # ' lst'
144
157
" Inside a list.
145
- " TODO Begin analysis and apply rules!
146
- " echom getline(coord[0], v:lnum - 1)
147
- return coord[1 ] + 1
158
+ return s: GetListIndent (coord)
148
159
elseif formtype == # ' vec' || formtype == # ' map'
149
160
" Inside a vector, map or set.
150
161
return coord[1 ]
0 commit comments