blob: 7c4186e29b4131f92038ba30a35253473732b415 [file] [log] [blame]
Bram Moolenaarfa13eef2013-02-06 17:34:04 +01001" Vim indent file
Bram Moolenaar6f1d9a02016-07-24 14:12:38 +02002" Language: Clojure
3" Author: Meikel Brandmeyer <mb@kotka.de>
4" URL: http://kotka.de/projects/clojure/vimclojure.html
Bram Moolenaarfa13eef2013-02-06 17:34:04 +01005"
Bram Moolenaar6f1d9a02016-07-24 14:12:38 +02006" Maintainer: Sung Pae <self@sungpae.com>
7" URL: https://github.com/guns/vim-clojure-static
8" License: Same as Vim
9" Last Change: 18 July 2016
Bram Moolenaarbaca7f72013-09-22 14:42:24 +020010
Bram Moolenaarfa13eef2013-02-06 17:34:04 +010011if exists("b:did_indent")
Bram Moolenaarbaca7f72013-09-22 14:42:24 +020012 finish
Bram Moolenaarfa13eef2013-02-06 17:34:04 +010013endif
14let b:did_indent = 1
15
16let s:save_cpo = &cpo
17set cpo&vim
18
Bram Moolenaara6878372014-03-22 21:02:50 +010019let b:undo_indent = 'setlocal autoindent< smartindent< expandtab< softtabstop< shiftwidth< indentexpr< indentkeys<'
Bram Moolenaarfa13eef2013-02-06 17:34:04 +010020
21setlocal noautoindent nosmartindent
22setlocal softtabstop=2 shiftwidth=2 expandtab
23setlocal indentkeys=!,o,O
24
25if exists("*searchpairpos")
26
Bram Moolenaarbaca7f72013-09-22 14:42:24 +020027 if !exists('g:clojure_maxlines')
28 let g:clojure_maxlines = 100
29 endif
Bram Moolenaarfa13eef2013-02-06 17:34:04 +010030
Bram Moolenaarbaca7f72013-09-22 14:42:24 +020031 if !exists('g:clojure_fuzzy_indent')
32 let g:clojure_fuzzy_indent = 1
33 endif
Bram Moolenaarfa13eef2013-02-06 17:34:04 +010034
Bram Moolenaarbaca7f72013-09-22 14:42:24 +020035 if !exists('g:clojure_fuzzy_indent_patterns')
36 let g:clojure_fuzzy_indent_patterns = ['^with', '^def', '^let']
37 endif
Bram Moolenaarfa13eef2013-02-06 17:34:04 +010038
Bram Moolenaarbaca7f72013-09-22 14:42:24 +020039 if !exists('g:clojure_fuzzy_indent_blacklist')
40 let g:clojure_fuzzy_indent_blacklist = ['-fn$', '\v^with-%(meta|out-str|loading-context)$']
41 endif
Bram Moolenaarfa13eef2013-02-06 17:34:04 +010042
Bram Moolenaarbaca7f72013-09-22 14:42:24 +020043 if !exists('g:clojure_special_indent_words')
44 let g:clojure_special_indent_words = 'deftype,defrecord,reify,proxy,extend-type,extend-protocol,letfn'
45 endif
Bram Moolenaarfa13eef2013-02-06 17:34:04 +010046
Bram Moolenaarbaca7f72013-09-22 14:42:24 +020047 if !exists('g:clojure_align_multiline_strings')
48 let g:clojure_align_multiline_strings = 0
49 endif
Bram Moolenaarfa13eef2013-02-06 17:34:04 +010050
Bram Moolenaar438f67a2014-01-07 06:09:28 +010051 if !exists('g:clojure_align_subforms')
52 let g:clojure_align_subforms = 0
53 endif
54
Bram Moolenaar6f1d9a02016-07-24 14:12:38 +020055 function! s:syn_id_name()
Bram Moolenaarbaca7f72013-09-22 14:42:24 +020056 return synIDattr(synID(line("."), col("."), 0), "name")
57 endfunction
Bram Moolenaarfa13eef2013-02-06 17:34:04 +010058
Bram Moolenaar6f1d9a02016-07-24 14:12:38 +020059 function! s:ignored_region()
60 return s:syn_id_name() =~? '\vstring|regex|comment|character'
61 endfunction
62
63 function! s:current_char()
Bram Moolenaarbaca7f72013-09-22 14:42:24 +020064 return getline('.')[col('.')-1]
65 endfunction
Bram Moolenaarfa13eef2013-02-06 17:34:04 +010066
Bram Moolenaar6f1d9a02016-07-24 14:12:38 +020067 function! s:current_word()
Bram Moolenaarbaca7f72013-09-22 14:42:24 +020068 return getline('.')[col('.')-1 : searchpos('\v>', 'n', line('.'))[1]-2]
69 endfunction
Bram Moolenaarfa13eef2013-02-06 17:34:04 +010070
Bram Moolenaar6f1d9a02016-07-24 14:12:38 +020071 function! s:is_paren()
72 return s:current_char() =~# '\v[\(\)\[\]\{\}]' && !s:ignored_region()
Bram Moolenaarbaca7f72013-09-22 14:42:24 +020073 endfunction
Bram Moolenaarfa13eef2013-02-06 17:34:04 +010074
Bram Moolenaarbaca7f72013-09-22 14:42:24 +020075 " Returns 1 if string matches a pattern in 'patterns', which may be a
76 " list of patterns, or a comma-delimited string of implicitly anchored
77 " patterns.
Bram Moolenaar6f1d9a02016-07-24 14:12:38 +020078 function! s:match_one(patterns, string)
Bram Moolenaarbaca7f72013-09-22 14:42:24 +020079 let list = type(a:patterns) == type([])
Bram Moolenaar6f1d9a02016-07-24 14:12:38 +020080 \ ? a:patterns
81 \ : map(split(a:patterns, ','), '"^" . v:val . "$"')
Bram Moolenaarbaca7f72013-09-22 14:42:24 +020082 for pat in list
Bram Moolenaar76f3b1a2014-03-27 22:30:07 +010083 if a:string =~# pat | return 1 | endif
Bram Moolenaarbaca7f72013-09-22 14:42:24 +020084 endfor
85 endfunction
Bram Moolenaarfa13eef2013-02-06 17:34:04 +010086
Bram Moolenaar6f1d9a02016-07-24 14:12:38 +020087 function! s:match_pairs(open, close, stopat)
Bram Moolenaarbaca7f72013-09-22 14:42:24 +020088 " Stop only on vector and map [ resp. {. Ignore the ones in strings and
89 " comments.
90 if a:stopat == 0
91 let stopat = max([line(".") - g:clojure_maxlines, 0])
92 else
93 let stopat = a:stopat
94 endif
Bram Moolenaarfa13eef2013-02-06 17:34:04 +010095
Bram Moolenaar6f1d9a02016-07-24 14:12:38 +020096 let pos = searchpairpos(a:open, '', a:close, 'bWn', "!s:is_paren()", stopat)
97 return [pos[0], col(pos)]
Bram Moolenaarbaca7f72013-09-22 14:42:24 +020098 endfunction
Bram Moolenaarfa13eef2013-02-06 17:34:04 +010099
Bram Moolenaar6f1d9a02016-07-24 14:12:38 +0200100 function! s:clojure_check_for_string_worker()
Bram Moolenaarbaca7f72013-09-22 14:42:24 +0200101 " Check whether there is the last character of the previous line is
102 " highlighted as a string. If so, we check whether it's a ". In this
103 " case we have to check also the previous character. The " might be the
104 " closing one. In case the we are still in the string, we search for the
105 " opening ". If this is not found we take the indent of the line.
106 let nb = prevnonblank(v:lnum - 1)
Bram Moolenaarfa13eef2013-02-06 17:34:04 +0100107
Bram Moolenaarbaca7f72013-09-22 14:42:24 +0200108 if nb == 0
109 return -1
110 endif
Bram Moolenaarfa13eef2013-02-06 17:34:04 +0100111
Bram Moolenaarbaca7f72013-09-22 14:42:24 +0200112 call cursor(nb, 0)
113 call cursor(0, col("$") - 1)
Bram Moolenaar6f1d9a02016-07-24 14:12:38 +0200114 if s:syn_id_name() !~? "string"
Bram Moolenaarbaca7f72013-09-22 14:42:24 +0200115 return -1
116 endif
Bram Moolenaarfa13eef2013-02-06 17:34:04 +0100117
Bram Moolenaarbaca7f72013-09-22 14:42:24 +0200118 " This will not work for a " in the first column...
Bram Moolenaar6f1d9a02016-07-24 14:12:38 +0200119 if s:current_char() == '"'
Bram Moolenaarbaca7f72013-09-22 14:42:24 +0200120 call cursor(0, col("$") - 2)
Bram Moolenaar6f1d9a02016-07-24 14:12:38 +0200121 if s:syn_id_name() !~? "string"
Bram Moolenaarbaca7f72013-09-22 14:42:24 +0200122 return -1
123 endif
Bram Moolenaar6f1d9a02016-07-24 14:12:38 +0200124 if s:current_char() != '\\'
Bram Moolenaarbaca7f72013-09-22 14:42:24 +0200125 return -1
126 endif
127 call cursor(0, col("$") - 1)
128 endif
Bram Moolenaarfa13eef2013-02-06 17:34:04 +0100129
Bram Moolenaarbaca7f72013-09-22 14:42:24 +0200130 let p = searchpos('\(^\|[^\\]\)\zs"', 'bW')
Bram Moolenaarfa13eef2013-02-06 17:34:04 +0100131
Bram Moolenaarbaca7f72013-09-22 14:42:24 +0200132 if p != [0, 0]
133 return p[1] - 1
134 endif
Bram Moolenaarfa13eef2013-02-06 17:34:04 +0100135
Bram Moolenaarbaca7f72013-09-22 14:42:24 +0200136 return indent(".")
137 endfunction
Bram Moolenaarfa13eef2013-02-06 17:34:04 +0100138
Bram Moolenaar6f1d9a02016-07-24 14:12:38 +0200139 function! s:check_for_string()
Bram Moolenaarbaca7f72013-09-22 14:42:24 +0200140 let pos = getpos('.')
141 try
Bram Moolenaar6f1d9a02016-07-24 14:12:38 +0200142 let val = s:clojure_check_for_string_worker()
Bram Moolenaarbaca7f72013-09-22 14:42:24 +0200143 finally
144 call setpos('.', pos)
145 endtry
146 return val
147 endfunction
Bram Moolenaarfa13eef2013-02-06 17:34:04 +0100148
Bram Moolenaar6f1d9a02016-07-24 14:12:38 +0200149 function! s:strip_namespace_and_macro_chars(word)
Bram Moolenaar76f3b1a2014-03-27 22:30:07 +0100150 return substitute(a:word, "\\v%(.*/|[#'`~@^,]*)(.*)", '\1', '')
151 endfunction
152
Bram Moolenaar6f1d9a02016-07-24 14:12:38 +0200153 function! s:clojure_is_method_special_case_worker(position)
Bram Moolenaarbaca7f72013-09-22 14:42:24 +0200154 " Find the next enclosing form.
155 call search('\S', 'Wb')
Bram Moolenaarfa13eef2013-02-06 17:34:04 +0100156
Bram Moolenaarbaca7f72013-09-22 14:42:24 +0200157 " Special case: we are at a '(('.
Bram Moolenaar6f1d9a02016-07-24 14:12:38 +0200158 if s:current_char() == '('
Bram Moolenaarbaca7f72013-09-22 14:42:24 +0200159 return 0
160 endif
161 call cursor(a:position)
Bram Moolenaarfa13eef2013-02-06 17:34:04 +0100162
Bram Moolenaar6f1d9a02016-07-24 14:12:38 +0200163 let next_paren = s:match_pairs('(', ')', 0)
Bram Moolenaarfa13eef2013-02-06 17:34:04 +0100164
Bram Moolenaarbaca7f72013-09-22 14:42:24 +0200165 " Special case: we are now at toplevel.
Bram Moolenaar6f1d9a02016-07-24 14:12:38 +0200166 if next_paren == [0, 0]
Bram Moolenaarbaca7f72013-09-22 14:42:24 +0200167 return 0
168 endif
Bram Moolenaar6f1d9a02016-07-24 14:12:38 +0200169 call cursor(next_paren)
Bram Moolenaarfa13eef2013-02-06 17:34:04 +0100170
Bram Moolenaarbaca7f72013-09-22 14:42:24 +0200171 call search('\S', 'W')
Bram Moolenaar6f1d9a02016-07-24 14:12:38 +0200172 let w = s:strip_namespace_and_macro_chars(s:current_word())
Bram Moolenaar76f3b1a2014-03-27 22:30:07 +0100173 if g:clojure_special_indent_words =~# '\V\<' . w . '\>'
Bram Moolenaarbaca7f72013-09-22 14:42:24 +0200174 return 1
175 endif
Bram Moolenaarfa13eef2013-02-06 17:34:04 +0100176
Bram Moolenaarbaca7f72013-09-22 14:42:24 +0200177 return 0
178 endfunction
Bram Moolenaarfa13eef2013-02-06 17:34:04 +0100179
Bram Moolenaar6f1d9a02016-07-24 14:12:38 +0200180 function! s:is_method_special_case(position)
Bram Moolenaarbaca7f72013-09-22 14:42:24 +0200181 let pos = getpos('.')
182 try
Bram Moolenaar6f1d9a02016-07-24 14:12:38 +0200183 let val = s:clojure_is_method_special_case_worker(a:position)
Bram Moolenaarbaca7f72013-09-22 14:42:24 +0200184 finally
185 call setpos('.', pos)
186 endtry
187 return val
188 endfunction
Bram Moolenaarfa13eef2013-02-06 17:34:04 +0100189
Bram Moolenaar6f1d9a02016-07-24 14:12:38 +0200190 " Check if form is a reader conditional, that is, it is prefixed by #?
191 " or @#?
192 function! s:is_reader_conditional_special_case(position)
193 if getline(a:position[0])[a:position[1] - 3 : a:position[1] - 2] == "#?"
194 return 1
195 endif
196
197 return 0
198 endfunction
199
200 " Returns 1 for opening brackets, -1 for _anything else_.
201 function! s:bracket_type(char)
202 return stridx('([{', a:char) > -1 ? 1 : -1
203 endfunction
204
205 " Returns: [opening-bracket-lnum, indent]
206 function! s:clojure_indent_pos()
Bram Moolenaarbaca7f72013-09-22 14:42:24 +0200207 " Get rid of special case.
208 if line(".") == 1
Bram Moolenaar6f1d9a02016-07-24 14:12:38 +0200209 return [0, 0]
Bram Moolenaarbaca7f72013-09-22 14:42:24 +0200210 endif
Bram Moolenaarfa13eef2013-02-06 17:34:04 +0100211
Bram Moolenaarbaca7f72013-09-22 14:42:24 +0200212 " We have to apply some heuristics here to figure out, whether to use
213 " normal lisp indenting or not.
Bram Moolenaar6f1d9a02016-07-24 14:12:38 +0200214 let i = s:check_for_string()
Bram Moolenaarbaca7f72013-09-22 14:42:24 +0200215 if i > -1
Bram Moolenaar6f1d9a02016-07-24 14:12:38 +0200216 return [0, i + !!g:clojure_align_multiline_strings]
Bram Moolenaarbaca7f72013-09-22 14:42:24 +0200217 endif
Bram Moolenaarfa13eef2013-02-06 17:34:04 +0100218
Bram Moolenaarbaca7f72013-09-22 14:42:24 +0200219 call cursor(0, 1)
Bram Moolenaarfa13eef2013-02-06 17:34:04 +0100220
Bram Moolenaarbaca7f72013-09-22 14:42:24 +0200221 " Find the next enclosing [ or {. We can limit the second search
222 " to the line, where the [ was found. If no [ was there this is
223 " zero and we search for an enclosing {.
Bram Moolenaar6f1d9a02016-07-24 14:12:38 +0200224 let paren = s:match_pairs('(', ')', 0)
225 let bracket = s:match_pairs('\[', '\]', paren[0])
226 let curly = s:match_pairs('{', '}', bracket[0])
Bram Moolenaarfa13eef2013-02-06 17:34:04 +0100227
Bram Moolenaarbaca7f72013-09-22 14:42:24 +0200228 " In case the curly brace is on a line later then the [ or - in
229 " case they are on the same line - in a higher column, we take the
230 " curly indent.
231 if curly[0] > bracket[0] || curly[1] > bracket[1]
232 if curly[0] > paren[0] || curly[1] > paren[1]
Bram Moolenaar6f1d9a02016-07-24 14:12:38 +0200233 return curly
Bram Moolenaarbaca7f72013-09-22 14:42:24 +0200234 endif
235 endif
Bram Moolenaarfa13eef2013-02-06 17:34:04 +0100236
Bram Moolenaarbaca7f72013-09-22 14:42:24 +0200237 " If the curly was not chosen, we take the bracket indent - if
238 " there was one.
239 if bracket[0] > paren[0] || bracket[1] > paren[1]
Bram Moolenaar6f1d9a02016-07-24 14:12:38 +0200240 return bracket
Bram Moolenaarbaca7f72013-09-22 14:42:24 +0200241 endif
Bram Moolenaarfa13eef2013-02-06 17:34:04 +0100242
Bram Moolenaarbaca7f72013-09-22 14:42:24 +0200243 " There are neither { nor [ nor (, ie. we are at the toplevel.
244 if paren == [0, 0]
Bram Moolenaar6f1d9a02016-07-24 14:12:38 +0200245 return paren
Bram Moolenaarbaca7f72013-09-22 14:42:24 +0200246 endif
Bram Moolenaarfa13eef2013-02-06 17:34:04 +0100247
Bram Moolenaarbaca7f72013-09-22 14:42:24 +0200248 " Now we have to reimplement lispindent. This is surprisingly easy, as
249 " soon as one has access to syntax items.
250 "
251 " - Check whether we are in a special position after a word in
252 " g:clojure_special_indent_words. These are special cases.
253 " - Get the next keyword after the (.
254 " - If its first character is also a (, we have another sexp and align
255 " one column to the right of the unmatched (.
256 " - In case it is in lispwords, we indent the next line to the column of
257 " the ( + sw.
258 " - If not, we check whether it is last word in the line. In that case
259 " we again use ( + sw for indent.
260 " - In any other case we use the column of the end of the word + 2.
261 call cursor(paren)
Bram Moolenaarfa13eef2013-02-06 17:34:04 +0100262
Bram Moolenaar6f1d9a02016-07-24 14:12:38 +0200263 if s:is_method_special_case(paren)
Bram Moolenaar3ec574f2017-06-13 18:12:01 +0200264 return [paren[0], paren[1] + shiftwidth() - 1]
Bram Moolenaar6f1d9a02016-07-24 14:12:38 +0200265 endif
266
267 if s:is_reader_conditional_special_case(paren)
268 return paren
Bram Moolenaarbaca7f72013-09-22 14:42:24 +0200269 endif
Bram Moolenaarfa13eef2013-02-06 17:34:04 +0100270
Bram Moolenaarbaca7f72013-09-22 14:42:24 +0200271 " In case we are at the last character, we use the paren position.
272 if col("$") - 1 == paren[1]
Bram Moolenaar6f1d9a02016-07-24 14:12:38 +0200273 return paren
Bram Moolenaarbaca7f72013-09-22 14:42:24 +0200274 endif
Bram Moolenaarfa13eef2013-02-06 17:34:04 +0100275
Bram Moolenaarbaca7f72013-09-22 14:42:24 +0200276 " In case after the paren is a whitespace, we search for the next word.
277 call cursor(0, col('.') + 1)
Bram Moolenaar6f1d9a02016-07-24 14:12:38 +0200278 if s:current_char() == ' '
Bram Moolenaarbaca7f72013-09-22 14:42:24 +0200279 call search('\v\S', 'W')
280 endif
Bram Moolenaarfa13eef2013-02-06 17:34:04 +0100281
Bram Moolenaarbaca7f72013-09-22 14:42:24 +0200282 " If we moved to another line, there is no word after the (. We
283 " use the ( position for indent.
284 if line(".") > paren[0]
Bram Moolenaar6f1d9a02016-07-24 14:12:38 +0200285 return paren
Bram Moolenaarbaca7f72013-09-22 14:42:24 +0200286 endif
Bram Moolenaarfa13eef2013-02-06 17:34:04 +0100287
Bram Moolenaarbaca7f72013-09-22 14:42:24 +0200288 " We still have to check, whether the keyword starts with a (, [ or {.
289 " In that case we use the ( position for indent.
Bram Moolenaar6f1d9a02016-07-24 14:12:38 +0200290 let w = s:current_word()
291 if s:bracket_type(w[0]) == 1
292 return paren
Bram Moolenaarbaca7f72013-09-22 14:42:24 +0200293 endif
Bram Moolenaarfa13eef2013-02-06 17:34:04 +0100294
Bram Moolenaarbaca7f72013-09-22 14:42:24 +0200295 " Test words without namespace qualifiers and leading reader macro
296 " metacharacters.
297 "
298 " e.g. clojure.core/defn and #'defn should both indent like defn.
Bram Moolenaar6f1d9a02016-07-24 14:12:38 +0200299 let ww = s:strip_namespace_and_macro_chars(w)
Bram Moolenaarfa13eef2013-02-06 17:34:04 +0100300
Bram Moolenaar76f3b1a2014-03-27 22:30:07 +0100301 if &lispwords =~# '\V\<' . ww . '\>'
Bram Moolenaar3ec574f2017-06-13 18:12:01 +0200302 return [paren[0], paren[1] + shiftwidth() - 1]
Bram Moolenaarbaca7f72013-09-22 14:42:24 +0200303 endif
Bram Moolenaarfa13eef2013-02-06 17:34:04 +0100304
Bram Moolenaarbaca7f72013-09-22 14:42:24 +0200305 if g:clojure_fuzzy_indent
Bram Moolenaar6f1d9a02016-07-24 14:12:38 +0200306 \ && !s:match_one(g:clojure_fuzzy_indent_blacklist, ww)
307 \ && s:match_one(g:clojure_fuzzy_indent_patterns, ww)
Bram Moolenaar3ec574f2017-06-13 18:12:01 +0200308 return [paren[0], paren[1] + shiftwidth() - 1]
Bram Moolenaarbaca7f72013-09-22 14:42:24 +0200309 endif
Bram Moolenaarfa13eef2013-02-06 17:34:04 +0100310
Bram Moolenaarbaca7f72013-09-22 14:42:24 +0200311 call search('\v\_s', 'cW')
312 call search('\v\S', 'W')
313 if paren[0] < line(".")
Bram Moolenaar3ec574f2017-06-13 18:12:01 +0200314 return [paren[0], paren[1] + (g:clojure_align_subforms ? 0 : shiftwidth() - 1)]
Bram Moolenaarbaca7f72013-09-22 14:42:24 +0200315 endif
Bram Moolenaarfa13eef2013-02-06 17:34:04 +0100316
Bram Moolenaarbaca7f72013-09-22 14:42:24 +0200317 call search('\v\S', 'bW')
Bram Moolenaar6f1d9a02016-07-24 14:12:38 +0200318 return [line('.'), col('.') + 1]
319 endfunction
320
321 function! GetClojureIndent()
322 let lnum = line('.')
323 let orig_lnum = lnum
324 let orig_col = col('.')
325 let [opening_lnum, indent] = s:clojure_indent_pos()
326
327 " Account for multibyte characters
328 if opening_lnum > 0
329 let indent -= indent - virtcol([opening_lnum, indent])
330 endif
331
332 " Return if there are no previous lines to inherit from
333 if opening_lnum < 1 || opening_lnum >= lnum - 1
334 call cursor(orig_lnum, orig_col)
335 return indent
336 endif
337
338 let bracket_count = 0
339
340 " Take the indent of the first previous non-white line that is
341 " at the same sexp level. cf. src/misc1.c:get_lisp_indent()
342 while 1
343 let lnum = prevnonblank(lnum - 1)
344 let col = 1
345
346 if lnum <= opening_lnum
347 break
348 endif
349
350 call cursor(lnum, col)
351
352 " Handle bracket counting edge case
353 if s:is_paren()
354 let bracket_count += s:bracket_type(s:current_char())
355 endif
356
357 while 1
358 if search('\v[(\[{}\])]', '', lnum) < 1
359 break
360 elseif !s:ignored_region()
361 let bracket_count += s:bracket_type(s:current_char())
362 endif
363 endwhile
364
365 if bracket_count == 0
366 " Check if this is part of a multiline string
367 call cursor(lnum, 1)
368 if s:syn_id_name() !~? '\vstring|regex'
369 call cursor(orig_lnum, orig_col)
370 return indent(lnum)
371 endif
372 endif
373 endwhile
374
375 call cursor(orig_lnum, orig_col)
376 return indent
Bram Moolenaarbaca7f72013-09-22 14:42:24 +0200377 endfunction
Bram Moolenaarfa13eef2013-02-06 17:34:04 +0100378
Bram Moolenaarbaca7f72013-09-22 14:42:24 +0200379 setlocal indentexpr=GetClojureIndent()
Bram Moolenaarfa13eef2013-02-06 17:34:04 +0100380
381else
382
Bram Moolenaarbaca7f72013-09-22 14:42:24 +0200383 " In case we have searchpairpos not available we fall back to
384 " normal lisp indenting.
385 setlocal indentexpr=
386 setlocal lisp
387 let b:undo_indent .= '| setlocal lisp<'
Bram Moolenaarfa13eef2013-02-06 17:34:04 +0100388
389endif
390
Bram Moolenaarfa13eef2013-02-06 17:34:04 +0100391let &cpo = s:save_cpo
392unlet! s:save_cpo
393
Bram Moolenaarbaca7f72013-09-22 14:42:24 +0200394" vim:sts=8:sw=8:ts=8:noet