diff options
Diffstat (limited to '')
-rw-r--r-- | indent/clojure.vim | 19 |
1 files changed, 14 insertions, 5 deletions
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. " |