@@ -21,8 +21,6 @@ setlocal noautoindent nosmartindent nolisp
2121setlocal softtabstop = 2 shiftwidth = 2 expandtab
2222setlocal indentkeys = ! ,o ,O
2323
24- " TODO: Write an optional Vim9 script version for better performance?
25-
2624function ! s: GetSynIdName (line , col )
2725 return synIDattr (synID (a: line , a: col , 0 ), ' name' )
2826endfunction
@@ -67,13 +65,6 @@ function! s:GetClojureIndent()
6765 " Move cursor to the first column of the line we want to indent.
6866 call cursor (v: lnum , 1 )
6967
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-
7768 " Improve accuracy of string detection when a newline is entered.
7869 if empty (getline (v: lnum ))
7970 let strline = v: lnum - 1
@@ -82,10 +73,17 @@ function! s:GetClojureIndent()
8273 let synname = s: GetSynIdName (v: lnum , 1 )
8374 endif
8475
76+ let s: best_match = [' top' , [0 , 0 ]]
77+
8578 if synname = ~? ' string'
8679 call s: CheckPair (' str' , ' "' , ' "' , function (' <SID>NotStringDelimiter' ))
8780 elseif synname = ~? ' regex'
8881 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)
8987 endif
9088
9189 " Find closest matching higher form.
@@ -109,9 +107,9 @@ function! s:GetClojureIndent()
109107 elseif formtype == ' reg'
110108 " Inside a regex.
111109 return coord[1 ] - (s: ShouldAlignMultiLineStrings () ? 0 : 2 )
110+ else
111+ return -1
112112 endif
113-
114- return 2
115113endfunction
116114
117115if exists (" *searchpairpos" )
0 commit comments