From e573da70357ad4eb73560abd825e692b02cec54f Mon Sep 17 00:00:00 2001 From: Alex Vear Date: Fri, 28 Apr 2023 14:46:18 +0100 Subject: [PATCH] EDN files are unlikely to contain many lists, so check them last --- indent/clojure.vim | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/indent/clojure.vim b/indent/clojure.vim index bcebbf6..1294d0f 100644 --- a/indent/clojure.vim +++ b/indent/clojure.vim @@ -120,9 +120,17 @@ function! s:GetClojureIndent() call s:CheckPair('reg', '#\zs"', '"', function('NotRegexpDelimiter')) else let IgnoredRegionFn = function('IgnoredRegion') - call s:CheckPair('lst', '(', ')', IgnoredRegionFn) - call s:CheckPair('map', '{', '}', IgnoredRegionFn) - call s:CheckPair('vec', '\[', '\]', IgnoredRegionFn) + if bufname() ==? '\.edn$' + " If EDN file, check list pair last. + call s:CheckPair('map', '{', '}', IgnoredRegionFn) + call s:CheckPair('vec', '\[', '\]', IgnoredRegionFn) + call s:CheckPair('lst', '(', ')', IgnoredRegionFn) + else + " If CLJ file, check list pair first. + call s:CheckPair('lst', '(', ')', IgnoredRegionFn) + call s:CheckPair('map', '{', '}', IgnoredRegionFn) + call s:CheckPair('vec', '\[', '\]', IgnoredRegionFn) + endif endif " Find closest matching higher form. @@ -145,10 +153,10 @@ function! s:GetClojureIndent() elseif formtype ==# 'reg' " Inside a regular expression. return s:GetStringIndent(coord, 1) + else + " Keep existing indent. + return -1 endif - - " Keep existing indent. - return -1 endfunction if exists("*searchpairpos")