summaryrefslogtreecommitdiffstats
path: root/indent/clojure.vim
diff options
context:
space:
mode:
authorAdam Stankiewicz <sheerun@sher.pl>2017-11-19 21:26:59 +0100
committerAdam Stankiewicz <sheerun@sher.pl>2017-11-19 21:27:05 +0100
commitd219055bc845253eff2b27d30a23b11b97b7ee9d (patch)
treea4586dfdbce3a304759a0c34175ee41fdede4e17 /indent/clojure.vim
parent0e9041f29a3288b6685aafc63d914c11fef539ba (diff)
downloadvim-polyglot-d219055bc845253eff2b27d30a23b11b97b7ee9d.tar.gz
vim-polyglot-d219055bc845253eff2b27d30a23b11b97b7ee9d.zip
Update
Diffstat (limited to 'indent/clojure.vim')
-rw-r--r--indent/clojure.vim19
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.
"