From 11f34624aa32ac72dc65e46ea9badb4b16a0edd1 Mon Sep 17 00:00:00 2001 From: Adam Stankiewicz Date: Tue, 19 Jul 2016 10:09:54 +0200 Subject: Update --- indent/clojure.vim | 32 +++++++++++++++++++++++--------- 1 file changed, 23 insertions(+), 9 deletions(-) (limited to 'indent/clojure.vim') diff --git a/indent/clojure.vim b/indent/clojure.vim index cb8c050b..1d474d8e 100644 --- a/indent/clojure.vim +++ b/indent/clojure.vim @@ -1,14 +1,14 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'clojure') == -1 " Vim indent file -" Language: Clojure -" Author: Meikel Brandmeyer -" URL: http://kotka.de/projects/clojure/vimclojure.html +" Language: Clojure +" Author: Meikel Brandmeyer +" URL: http://kotka.de/projects/clojure/vimclojure.html " -" Maintainer: Sung Pae -" URL: https://github.com/guns/vim-clojure-static -" License: Same as Vim -" Last Change: %%RELEASE_DATE%% +" Maintainer: Sung Pae +" URL: https://github.com/guns/vim-clojure-static +" License: Same as Vim +" Last Change: %%RELEASE_DATE%% if exists("b:did_indent") finish @@ -79,8 +79,8 @@ if exists("*searchpairpos") " patterns. function! s:match_one(patterns, string) let list = type(a:patterns) == type([]) - \ ? a:patterns - \ : map(split(a:patterns, ','), '"^" . v:val . "$"') + \ ? a:patterns + \ : map(split(a:patterns, ','), '"^" . v:val . "$"') for pat in list if a:string =~# pat | return 1 | endif endfor @@ -189,6 +189,16 @@ if exists("*searchpairpos") return val endfunction + " 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 + endfunction + " Returns 1 for opening brackets, -1 for _anything else_. function! s:bracket_type(char) return stridx('([{', a:char) > -1 ? 1 : -1 @@ -256,6 +266,10 @@ if exists("*searchpairpos") return [paren[0], paren[1] + &shiftwidth - 1] endif + if s:is_reader_conditional_special_case(paren) + return paren + endif + " In case we are at the last character, we use the paren position. if col("$") - 1 == paren[1] return paren -- cgit v1.2.3