Skip to content

Commit e573da7

Browse files
committed
EDN files are unlikely to contain many lists, so check them last
1 parent 51e6a43 commit e573da7

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

indent/clojure.vim

+14-6
Original file line numberDiff line numberDiff line change
@@ -120,9 +120,17 @@ function! s:GetClojureIndent()
120120
call s:CheckPair('reg', '#\zs"', '"', function('<SID>NotRegexpDelimiter'))
121121
else
122122
let IgnoredRegionFn = function('<SID>IgnoredRegion')
123-
call s:CheckPair('lst', '(', ')', IgnoredRegionFn)
124-
call s:CheckPair('map', '{', '}', IgnoredRegionFn)
125-
call s:CheckPair('vec', '\[', '\]', IgnoredRegionFn)
123+
if bufname() ==? '\.edn$'
124+
" If EDN file, check list pair last.
125+
call s:CheckPair('map', '{', '}', IgnoredRegionFn)
126+
call s:CheckPair('vec', '\[', '\]', IgnoredRegionFn)
127+
call s:CheckPair('lst', '(', ')', IgnoredRegionFn)
128+
else
129+
" If CLJ file, check list pair first.
130+
call s:CheckPair('lst', '(', ')', IgnoredRegionFn)
131+
call s:CheckPair('map', '{', '}', IgnoredRegionFn)
132+
call s:CheckPair('vec', '\[', '\]', IgnoredRegionFn)
133+
endif
126134
endif
127135

128136
" Find closest matching higher form.
@@ -145,10 +153,10 @@ function! s:GetClojureIndent()
145153
elseif formtype ==# 'reg'
146154
" Inside a regular expression.
147155
return s:GetStringIndent(coord, 1)
156+
else
157+
" Keep existing indent.
158+
return -1
148159
endif
149-
150-
" Keep existing indent.
151-
return -1
152160
endfunction
153161

154162
if exists("*searchpairpos")

0 commit comments

Comments
 (0)