Skip to content

Commit 0a835d8

Browse files
committed
Update indent regular expressions to set the required 'magic' mode
Makes indentation more robust against users toggling the `'magic'` option.
1 parent 058b4a7 commit 0a835d8

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

indent/clojure.vim

+9-9
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@ endfunction
3838
call s:SConf('clojure_indent_style', 'standard')
3939
call s:SConf('clojure_indent_multiline_strings', 'standard')
4040
call s:SConf('clojure_fuzzy_indent_patterns', [
41-
\ '^with-\%(meta\|in-str\|out-str\|loading-context\)\@!',
42-
\ '^def',
43-
\ '^let'
41+
\ '\m^with-\%(meta\|in-str\|out-str\|loading-context\)\@!',
42+
\ '\m^def',
43+
\ '\m^let'
4444
\ ])
4545

4646
" FIXME: reader conditional indentation?
@@ -89,13 +89,13 @@ function! s:FirstFnArgPos(pos)
8989
let lnr = a:pos[0]
9090
let s:in_form_current_form = a:pos
9191
call cursor(lnr, a:pos[1] + 1)
92-
return searchpos('[ ,]\+\zs', 'z', lnr, 0, function('<SID>IsSubForm'))
92+
return searchpos('\m[ ,]\+\zs', 'z', lnr, 0, function('<SID>IsSubForm'))
9393
endfunction
9494

9595
" Used by "s:FirstFnArgPos" function to skip over subforms as the first value
9696
" in a list form.
9797
function! s:IsSubForm()
98-
let pos = searchpairpos('[([{"]', '', '[)\]}"]', 'b')
98+
let pos = searchpairpos('\m[([{"]', '', '\m[)\]}"]', 'b')
9999
return pos != [0, 0] && pos != s:in_form_current_form
100100
endfunction
101101

@@ -118,7 +118,7 @@ function! s:TokeniseLine(line_num)
118118
while 1
119119
" We perform searches within the buffer (and move the cusor)
120120
" for better performance than looping char by char in a line.
121-
let token_pos = searchpos('[()[\]{};"]', 'bW', a:line_num)
121+
let token_pos = searchpos('\m[()[\]{};"]', 'bW', a:line_num)
122122

123123
" No more matches, exit loop.
124124
if token_pos == [0, 0] | break | endif
@@ -266,13 +266,13 @@ function! s:ListIndent(delim_pos)
266266
" TODO: simplify this.
267267
let syms = split(ln_content, '[[:space:],;()\[\]{}@\\"^~`]', 1)
268268

269-
if !empty(syms)
269+
if ! empty(syms)
270270
let sym = syms[0]
271271
if sym =~# '\v^%([a-zA-Z!$&*_+=|<>?-]|[^\x00-\x7F])'
272272

273273
" TODO: handle namespaced and non-namespaced variants.
274-
if sym =~# './.'
275-
let [_namespace, name] = split(sym, '/')
274+
if sym =~# '\m./.'
275+
let [_namespace, name] = split(sym, '\m/')
276276
endif
277277

278278
" TODO: replace `clojure_fuzzy_indent_patterns` with `clojure_indent_patterns`?

0 commit comments

Comments
 (0)