From d219055bc845253eff2b27d30a23b11b97b7ee9d Mon Sep 17 00:00:00 2001 From: Adam Stankiewicz Date: Sun, 19 Nov 2017 21:26:59 +0100 Subject: Update --- indent/clojure.vim | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) (limited to 'indent/clojure.vim') diff --git a/indent/clojure.vim b/indent/clojure.vim index f538195a..6d21c3d1 100644 --- a/indent/clojure.vim +++ b/indent/clojure.vim @@ -192,11 +192,7 @@ if exists("*searchpairpos") " Check if form is a reader conditional, that is, it is prefixed by #? " or @#? function! s:is_reader_conditional_special_case(position) - if getline(a:position[0])[a:position[1] - 3 : a:position[1] - 2] == "#?" - return 1 - endif - - return 0 + return getline(a:position[0])[a:position[1] - 3 : a:position[1] - 2] == "#?" endfunction " Returns 1 for opening brackets, -1 for _anything else_. @@ -294,6 +290,19 @@ if exists("*searchpairpos") return paren endif + " If the keyword begins with #, check if it is an anonymous + " function or set, in which case we indent by the shiftwidth + " (minus one if g:clojure_align_subforms = 1), or if it is + " ignored, in which case we use the ( position for indent. + if w[0] == "#" + " TODO: Handle #=() and other rare reader invocations? + if w[1] == '(' || w[1] == '{' + return [paren[0], paren[1] + (g:clojure_align_subforms ? 0 : &shiftwidth - 1)] + elseif w[1] == '_' + return paren + endif + endif + " Test words without namespace qualifiers and leading reader macro " metacharacters. " -- cgit v1.2.3