Skip to content

Commit f4e0689

Browse files
committed
Check for maps before vectors for further performance enhancement
Since maps are far more likely to across multiple lines than vectors (and when they are they tend to be much larger, e.g. EDN files!), we can further optimise indentation by checking if the line is inside a map *before* checking it is inside a vector. (This happens because of the performance improvement made with the addition of the optimised `CheckPair` function.)
1 parent 5f083ff commit f4e0689

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

indent/clojure.vim

+1-2
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ setlocal softtabstop=2 shiftwidth=2 expandtab
2222
setlocal indentkeys=!,o,O
2323

2424
" TODO: ignore 'lisp' and 'lispwords' options (actually, turn them off?)
25-
2625
" TODO: Optional Vim9script implementations of hotspot/bottleneck functions?
2726
" FIXME: fallback case when syntax highlighting is disabled.
2827

@@ -75,8 +74,8 @@ function! s:GetClojureIndent()
7574
let s:best_match = ['top', [0, 0]]
7675

7776
call s:CheckPair('lst', '(', ')', function('<SID>IgnoredRegion'))
78-
call s:CheckPair('vec', '\[', '\]', function('<SID>IgnoredRegion'))
7977
call s:CheckPair('map', '{', '}', function('<SID>IgnoredRegion'))
78+
call s:CheckPair('vec', '\[', '\]', function('<SID>IgnoredRegion'))
8079

8180
let synname = s:GetSynIdName(lnum, col('.'))
8281
if synname =~? 'string'

0 commit comments

Comments
 (0)