@@ -21,8 +21,6 @@ setlocal noautoindent nosmartindent nolisp
21
21
setlocal softtabstop = 2 shiftwidth = 2 expandtab
22
22
setlocal indentkeys = ! ,o ,O
23
23
24
- " TODO: Write an optional Vim9 script version for better performance?
25
-
26
24
function ! s: GetSynIdName (line , col )
27
25
return synIDattr (synID (a: line , a: col , 0 ), ' name' )
28
26
endfunction
@@ -67,13 +65,6 @@ function! s:GetClojureIndent()
67
65
" Move cursor to the first column of the line we want to indent.
68
66
call cursor (v: lnum , 1 )
69
67
70
- let s: best_match = [' top' , [0 , 0 ]]
71
-
72
- let IgnoredRegionFn = function (' <SID>IgnoredRegion' )
73
- call s: CheckPair (' lst' , ' (' , ' )' , IgnoredRegionFn)
74
- call s: CheckPair (' map' , ' {' , ' }' , IgnoredRegionFn)
75
- call s: CheckPair (' vec' , ' \[' , ' \]' , IgnoredRegionFn)
76
-
77
68
" Improve accuracy of string detection when a newline is entered.
78
69
if empty (getline (v: lnum ))
79
70
let strline = v: lnum - 1
@@ -82,10 +73,17 @@ function! s:GetClojureIndent()
82
73
let synname = s: GetSynIdName (v: lnum , 1 )
83
74
endif
84
75
76
+ let s: best_match = [' top' , [0 , 0 ]]
77
+
85
78
if synname = ~? ' string'
86
79
call s: CheckPair (' str' , ' "' , ' "' , function (' <SID>NotStringDelimiter' ))
87
80
elseif synname = ~? ' regex'
88
81
call s: CheckPair (' reg' , ' #\zs"' , ' "' , function (' <SID>NotRegexpDelimiter' ))
82
+ else
83
+ let IgnoredRegionFn = function (' <SID>IgnoredRegion' )
84
+ call s: CheckPair (' lst' , ' (' , ' )' , IgnoredRegionFn)
85
+ call s: CheckPair (' map' , ' {' , ' }' , IgnoredRegionFn)
86
+ call s: CheckPair (' vec' , ' \[' , ' \]' , IgnoredRegionFn)
89
87
endif
90
88
91
89
" Find closest matching higher form.
@@ -109,9 +107,9 @@ function! s:GetClojureIndent()
109
107
elseif formtype == ' reg'
110
108
" Inside a regex.
111
109
return coord[1 ] - (s: ShouldAlignMultiLineStrings () ? 0 : 2 )
110
+ else
111
+ return -1
112
112
endif
113
-
114
- return 2
115
113
endfunction
116
114
117
115
if exists (" *searchpairpos" )
0 commit comments