annotate runtime/indent/clojure.vim @ 33191:4efe5f797919 v9.0.1875

patch 9.0.1875: Vim9: improve test for disassemble + static Commit: https://github.com/vim/vim/commit/28a60f898d5cd7023596b0e96a081b1573edc807 Author: Yegappan Lakshmanan <yegappan@yahoo.com> Date: Tue Sep 5 20:42:18 2023 +0200 patch 9.0.1875: Vim9: improve test for disassemble + static Problem: Vim9: improve test for disassemble + static Solution: Add a Vim9 script disassemble test for an interface with static members closes: #13037 Signed-off-by: Christian Brabandt <cb@256bit.org> Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
author Christian Brabandt <cb@256bit.org>
date Tue, 05 Sep 2023 20:45:05 +0200
parents e3d6184b89fa
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
4098
058f26a834c4 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
1 " Vim indent file
23931
5b37a0bf7e3a Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 11518
diff changeset
2 " Language: Clojure
26100
babd9f1dbe12 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 23931
diff changeset
3 " Maintainer: Alex Vear <alex@vear.uk>
23931
5b37a0bf7e3a Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 11518
diff changeset
4 " Former Maintainers: Sung Pae <self@sungpae.com>
5b37a0bf7e3a Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 11518
diff changeset
5 " Meikel Brandmeyer <mb@kotka.de>
5b37a0bf7e3a Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 11518
diff changeset
6 " URL: https://github.com/clojure-vim/clojure.vim
5b37a0bf7e3a Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 11518
diff changeset
7 " License: Vim (see :h license)
28246
e3d6184b89fa Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 26100
diff changeset
8 " Last Change: 2022-03-24
5362
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 4098
diff changeset
9
4098
058f26a834c4 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
10 if exists("b:did_indent")
5362
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 4098
diff changeset
11 finish
4098
058f26a834c4 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
12 endif
058f26a834c4 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
13 let b:did_indent = 1
058f26a834c4 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
14
058f26a834c4 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
15 let s:save_cpo = &cpo
058f26a834c4 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
16 set cpo&vim
058f26a834c4 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
17
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5577
diff changeset
18 let b:undo_indent = 'setlocal autoindent< smartindent< expandtab< softtabstop< shiftwidth< indentexpr< indentkeys<'
4098
058f26a834c4 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
19
058f26a834c4 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
20 setlocal noautoindent nosmartindent
058f26a834c4 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
21 setlocal softtabstop=2 shiftwidth=2 expandtab
058f26a834c4 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
22 setlocal indentkeys=!,o,O
058f26a834c4 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
23
058f26a834c4 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
24 if exists("*searchpairpos")
058f26a834c4 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
25
5362
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 4098
diff changeset
26 if !exists('g:clojure_maxlines')
26100
babd9f1dbe12 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 23931
diff changeset
27 let g:clojure_maxlines = 300
5362
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 4098
diff changeset
28 endif
4098
058f26a834c4 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
29
5362
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 4098
diff changeset
30 if !exists('g:clojure_fuzzy_indent')
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 4098
diff changeset
31 let g:clojure_fuzzy_indent = 1
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 4098
diff changeset
32 endif
4098
058f26a834c4 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
33
5362
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 4098
diff changeset
34 if !exists('g:clojure_fuzzy_indent_patterns')
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 4098
diff changeset
35 let g:clojure_fuzzy_indent_patterns = ['^with', '^def', '^let']
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 4098
diff changeset
36 endif
4098
058f26a834c4 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
37
5362
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 4098
diff changeset
38 if !exists('g:clojure_fuzzy_indent_blacklist')
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 4098
diff changeset
39 let g:clojure_fuzzy_indent_blacklist = ['-fn$', '\v^with-%(meta|out-str|loading-context)$']
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 4098
diff changeset
40 endif
4098
058f26a834c4 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
41
5362
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 4098
diff changeset
42 if !exists('g:clojure_special_indent_words')
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 4098
diff changeset
43 let g:clojure_special_indent_words = 'deftype,defrecord,reify,proxy,extend-type,extend-protocol,letfn'
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 4098
diff changeset
44 endif
4098
058f26a834c4 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
45
5362
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 4098
diff changeset
46 if !exists('g:clojure_align_multiline_strings')
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 4098
diff changeset
47 let g:clojure_align_multiline_strings = 0
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 4098
diff changeset
48 endif
4098
058f26a834c4 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
49
5577
de28b1568fc2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5362
diff changeset
50 if !exists('g:clojure_align_subforms')
de28b1568fc2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5362
diff changeset
51 let g:clojure_align_subforms = 0
de28b1568fc2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5362
diff changeset
52 endif
de28b1568fc2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5362
diff changeset
53
9644
9f7bcc2c3b97 commit https://github.com/vim/vim/commit/6f1d9a096bf22d50c727dca73abbfb8e3ff55176
Christian Brabandt <cb@256bit.org>
parents: 5763
diff changeset
54 function! s:syn_id_name()
5362
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 4098
diff changeset
55 return synIDattr(synID(line("."), col("."), 0), "name")
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 4098
diff changeset
56 endfunction
4098
058f26a834c4 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
57
9644
9f7bcc2c3b97 commit https://github.com/vim/vim/commit/6f1d9a096bf22d50c727dca73abbfb8e3ff55176
Christian Brabandt <cb@256bit.org>
parents: 5763
diff changeset
58 function! s:ignored_region()
9f7bcc2c3b97 commit https://github.com/vim/vim/commit/6f1d9a096bf22d50c727dca73abbfb8e3ff55176
Christian Brabandt <cb@256bit.org>
parents: 5763
diff changeset
59 return s:syn_id_name() =~? '\vstring|regex|comment|character'
9f7bcc2c3b97 commit https://github.com/vim/vim/commit/6f1d9a096bf22d50c727dca73abbfb8e3ff55176
Christian Brabandt <cb@256bit.org>
parents: 5763
diff changeset
60 endfunction
9f7bcc2c3b97 commit https://github.com/vim/vim/commit/6f1d9a096bf22d50c727dca73abbfb8e3ff55176
Christian Brabandt <cb@256bit.org>
parents: 5763
diff changeset
61
9f7bcc2c3b97 commit https://github.com/vim/vim/commit/6f1d9a096bf22d50c727dca73abbfb8e3ff55176
Christian Brabandt <cb@256bit.org>
parents: 5763
diff changeset
62 function! s:current_char()
5362
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 4098
diff changeset
63 return getline('.')[col('.')-1]
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 4098
diff changeset
64 endfunction
4098
058f26a834c4 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
65
9644
9f7bcc2c3b97 commit https://github.com/vim/vim/commit/6f1d9a096bf22d50c727dca73abbfb8e3ff55176
Christian Brabandt <cb@256bit.org>
parents: 5763
diff changeset
66 function! s:current_word()
5362
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 4098
diff changeset
67 return getline('.')[col('.')-1 : searchpos('\v>', 'n', line('.'))[1]-2]
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 4098
diff changeset
68 endfunction
4098
058f26a834c4 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
69
9644
9f7bcc2c3b97 commit https://github.com/vim/vim/commit/6f1d9a096bf22d50c727dca73abbfb8e3ff55176
Christian Brabandt <cb@256bit.org>
parents: 5763
diff changeset
70 function! s:is_paren()
9f7bcc2c3b97 commit https://github.com/vim/vim/commit/6f1d9a096bf22d50c727dca73abbfb8e3ff55176
Christian Brabandt <cb@256bit.org>
parents: 5763
diff changeset
71 return s:current_char() =~# '\v[\(\)\[\]\{\}]' && !s:ignored_region()
5362
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 4098
diff changeset
72 endfunction
4098
058f26a834c4 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
73
26100
babd9f1dbe12 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 23931
diff changeset
74 " Returns 1 if string matches a pattern in 'patterns', which should be
babd9f1dbe12 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 23931
diff changeset
75 " a list of patterns.
9644
9f7bcc2c3b97 commit https://github.com/vim/vim/commit/6f1d9a096bf22d50c727dca73abbfb8e3ff55176
Christian Brabandt <cb@256bit.org>
parents: 5763
diff changeset
76 function! s:match_one(patterns, string)
26100
babd9f1dbe12 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 23931
diff changeset
77 for pat in a:patterns
5763
c52a655d927d Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5734
diff changeset
78 if a:string =~# pat | return 1 | endif
5362
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 4098
diff changeset
79 endfor
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 4098
diff changeset
80 endfunction
4098
058f26a834c4 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
81
9644
9f7bcc2c3b97 commit https://github.com/vim/vim/commit/6f1d9a096bf22d50c727dca73abbfb8e3ff55176
Christian Brabandt <cb@256bit.org>
parents: 5763
diff changeset
82 function! s:match_pairs(open, close, stopat)
5362
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 4098
diff changeset
83 " Stop only on vector and map [ resp. {. Ignore the ones in strings and
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 4098
diff changeset
84 " comments.
23931
5b37a0bf7e3a Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 11518
diff changeset
85 if a:stopat == 0 && g:clojure_maxlines > 0
5362
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 4098
diff changeset
86 let stopat = max([line(".") - g:clojure_maxlines, 0])
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 4098
diff changeset
87 else
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 4098
diff changeset
88 let stopat = a:stopat
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 4098
diff changeset
89 endif
4098
058f26a834c4 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
90
9644
9f7bcc2c3b97 commit https://github.com/vim/vim/commit/6f1d9a096bf22d50c727dca73abbfb8e3ff55176
Christian Brabandt <cb@256bit.org>
parents: 5763
diff changeset
91 let pos = searchpairpos(a:open, '', a:close, 'bWn', "!s:is_paren()", stopat)
9f7bcc2c3b97 commit https://github.com/vim/vim/commit/6f1d9a096bf22d50c727dca73abbfb8e3ff55176
Christian Brabandt <cb@256bit.org>
parents: 5763
diff changeset
92 return [pos[0], col(pos)]
5362
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 4098
diff changeset
93 endfunction
4098
058f26a834c4 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
94
9644
9f7bcc2c3b97 commit https://github.com/vim/vim/commit/6f1d9a096bf22d50c727dca73abbfb8e3ff55176
Christian Brabandt <cb@256bit.org>
parents: 5763
diff changeset
95 function! s:clojure_check_for_string_worker()
5362
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 4098
diff changeset
96 " Check whether there is the last character of the previous line is
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 4098
diff changeset
97 " highlighted as a string. If so, we check whether it's a ". In this
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 4098
diff changeset
98 " case we have to check also the previous character. The " might be the
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 4098
diff changeset
99 " closing one. In case the we are still in the string, we search for the
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 4098
diff changeset
100 " opening ". If this is not found we take the indent of the line.
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 4098
diff changeset
101 let nb = prevnonblank(v:lnum - 1)
4098
058f26a834c4 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
102
5362
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 4098
diff changeset
103 if nb == 0
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 4098
diff changeset
104 return -1
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 4098
diff changeset
105 endif
4098
058f26a834c4 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
106
5362
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 4098
diff changeset
107 call cursor(nb, 0)
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 4098
diff changeset
108 call cursor(0, col("$") - 1)
9644
9f7bcc2c3b97 commit https://github.com/vim/vim/commit/6f1d9a096bf22d50c727dca73abbfb8e3ff55176
Christian Brabandt <cb@256bit.org>
parents: 5763
diff changeset
109 if s:syn_id_name() !~? "string"
5362
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 4098
diff changeset
110 return -1
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 4098
diff changeset
111 endif
4098
058f26a834c4 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
112
5362
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 4098
diff changeset
113 " This will not work for a " in the first column...
9644
9f7bcc2c3b97 commit https://github.com/vim/vim/commit/6f1d9a096bf22d50c727dca73abbfb8e3ff55176
Christian Brabandt <cb@256bit.org>
parents: 5763
diff changeset
114 if s:current_char() == '"'
5362
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 4098
diff changeset
115 call cursor(0, col("$") - 2)
9644
9f7bcc2c3b97 commit https://github.com/vim/vim/commit/6f1d9a096bf22d50c727dca73abbfb8e3ff55176
Christian Brabandt <cb@256bit.org>
parents: 5763
diff changeset
116 if s:syn_id_name() !~? "string"
5362
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 4098
diff changeset
117 return -1
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 4098
diff changeset
118 endif
23931
5b37a0bf7e3a Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 11518
diff changeset
119 if s:current_char() != '\'
5362
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 4098
diff changeset
120 return -1
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 4098
diff changeset
121 endif
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 4098
diff changeset
122 call cursor(0, col("$") - 1)
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 4098
diff changeset
123 endif
4098
058f26a834c4 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
124
5362
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 4098
diff changeset
125 let p = searchpos('\(^\|[^\\]\)\zs"', 'bW')
4098
058f26a834c4 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
126
5362
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 4098
diff changeset
127 if p != [0, 0]
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 4098
diff changeset
128 return p[1] - 1
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 4098
diff changeset
129 endif
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 4098
diff changeset
130
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 4098
diff changeset
131 return indent(".")
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 4098
diff changeset
132 endfunction
4098
058f26a834c4 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
133
9644
9f7bcc2c3b97 commit https://github.com/vim/vim/commit/6f1d9a096bf22d50c727dca73abbfb8e3ff55176
Christian Brabandt <cb@256bit.org>
parents: 5763
diff changeset
134 function! s:check_for_string()
5362
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 4098
diff changeset
135 let pos = getpos('.')
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 4098
diff changeset
136 try
9644
9f7bcc2c3b97 commit https://github.com/vim/vim/commit/6f1d9a096bf22d50c727dca73abbfb8e3ff55176
Christian Brabandt <cb@256bit.org>
parents: 5763
diff changeset
137 let val = s:clojure_check_for_string_worker()
5362
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 4098
diff changeset
138 finally
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 4098
diff changeset
139 call setpos('.', pos)
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 4098
diff changeset
140 endtry
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 4098
diff changeset
141 return val
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 4098
diff changeset
142 endfunction
4098
058f26a834c4 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
143
9644
9f7bcc2c3b97 commit https://github.com/vim/vim/commit/6f1d9a096bf22d50c727dca73abbfb8e3ff55176
Christian Brabandt <cb@256bit.org>
parents: 5763
diff changeset
144 function! s:strip_namespace_and_macro_chars(word)
5763
c52a655d927d Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5734
diff changeset
145 return substitute(a:word, "\\v%(.*/|[#'`~@^,]*)(.*)", '\1', '')
c52a655d927d Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5734
diff changeset
146 endfunction
c52a655d927d Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5734
diff changeset
147
9644
9f7bcc2c3b97 commit https://github.com/vim/vim/commit/6f1d9a096bf22d50c727dca73abbfb8e3ff55176
Christian Brabandt <cb@256bit.org>
parents: 5763
diff changeset
148 function! s:clojure_is_method_special_case_worker(position)
5362
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 4098
diff changeset
149 " Find the next enclosing form.
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 4098
diff changeset
150 call search('\S', 'Wb')
4098
058f26a834c4 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
151
5362
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 4098
diff changeset
152 " Special case: we are at a '(('.
9644
9f7bcc2c3b97 commit https://github.com/vim/vim/commit/6f1d9a096bf22d50c727dca73abbfb8e3ff55176
Christian Brabandt <cb@256bit.org>
parents: 5763
diff changeset
153 if s:current_char() == '('
5362
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 4098
diff changeset
154 return 0
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 4098
diff changeset
155 endif
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 4098
diff changeset
156 call cursor(a:position)
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 4098
diff changeset
157
9644
9f7bcc2c3b97 commit https://github.com/vim/vim/commit/6f1d9a096bf22d50c727dca73abbfb8e3ff55176
Christian Brabandt <cb@256bit.org>
parents: 5763
diff changeset
158 let next_paren = s:match_pairs('(', ')', 0)
4098
058f26a834c4 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
159
5362
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 4098
diff changeset
160 " Special case: we are now at toplevel.
9644
9f7bcc2c3b97 commit https://github.com/vim/vim/commit/6f1d9a096bf22d50c727dca73abbfb8e3ff55176
Christian Brabandt <cb@256bit.org>
parents: 5763
diff changeset
161 if next_paren == [0, 0]
5362
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 4098
diff changeset
162 return 0
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 4098
diff changeset
163 endif
9644
9f7bcc2c3b97 commit https://github.com/vim/vim/commit/6f1d9a096bf22d50c727dca73abbfb8e3ff55176
Christian Brabandt <cb@256bit.org>
parents: 5763
diff changeset
164 call cursor(next_paren)
4098
058f26a834c4 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
165
5362
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 4098
diff changeset
166 call search('\S', 'W')
9644
9f7bcc2c3b97 commit https://github.com/vim/vim/commit/6f1d9a096bf22d50c727dca73abbfb8e3ff55176
Christian Brabandt <cb@256bit.org>
parents: 5763
diff changeset
167 let w = s:strip_namespace_and_macro_chars(s:current_word())
23931
5b37a0bf7e3a Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 11518
diff changeset
168
5763
c52a655d927d Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5734
diff changeset
169 if g:clojure_special_indent_words =~# '\V\<' . w . '\>'
23931
5b37a0bf7e3a Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 11518
diff changeset
170
5b37a0bf7e3a Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 11518
diff changeset
171 " `letfn` is a special-special-case.
5b37a0bf7e3a Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 11518
diff changeset
172 if w ==# 'letfn'
5b37a0bf7e3a Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 11518
diff changeset
173 " Earlier code left the cursor at:
5b37a0bf7e3a Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 11518
diff changeset
174 " (letfn [...] ...)
5b37a0bf7e3a Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 11518
diff changeset
175 " ^
5b37a0bf7e3a Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 11518
diff changeset
176
5b37a0bf7e3a Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 11518
diff changeset
177 " Search and get coordinates of first `[`
5b37a0bf7e3a Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 11518
diff changeset
178 " (letfn [...] ...)
5b37a0bf7e3a Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 11518
diff changeset
179 " ^
5b37a0bf7e3a Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 11518
diff changeset
180 call search('\[', 'W')
5b37a0bf7e3a Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 11518
diff changeset
181 let pos = getcurpos()
5b37a0bf7e3a Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 11518
diff changeset
182 let letfn_bracket = [pos[1], pos[2]]
5b37a0bf7e3a Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 11518
diff changeset
183
5b37a0bf7e3a Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 11518
diff changeset
184 " Move cursor to start of the form this function was
5b37a0bf7e3a Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 11518
diff changeset
185 " initially called on. Grab the coordinates of the
5b37a0bf7e3a Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 11518
diff changeset
186 " closest outer `[`.
5b37a0bf7e3a Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 11518
diff changeset
187 call cursor(a:position)
5b37a0bf7e3a Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 11518
diff changeset
188 let outer_bracket = s:match_pairs('\[', '\]', 0)
5b37a0bf7e3a Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 11518
diff changeset
189
5b37a0bf7e3a Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 11518
diff changeset
190 " If the located square brackets are not the same,
5b37a0bf7e3a Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 11518
diff changeset
191 " don't use special-case formatting.
5b37a0bf7e3a Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 11518
diff changeset
192 if outer_bracket != letfn_bracket
5b37a0bf7e3a Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 11518
diff changeset
193 return 0
5b37a0bf7e3a Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 11518
diff changeset
194 endif
5b37a0bf7e3a Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 11518
diff changeset
195 endif
5b37a0bf7e3a Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 11518
diff changeset
196
5362
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 4098
diff changeset
197 return 1
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 4098
diff changeset
198 endif
4098
058f26a834c4 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
199
5362
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 4098
diff changeset
200 return 0
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 4098
diff changeset
201 endfunction
4098
058f26a834c4 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
202
9644
9f7bcc2c3b97 commit https://github.com/vim/vim/commit/6f1d9a096bf22d50c727dca73abbfb8e3ff55176
Christian Brabandt <cb@256bit.org>
parents: 5763
diff changeset
203 function! s:is_method_special_case(position)
5362
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 4098
diff changeset
204 let pos = getpos('.')
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 4098
diff changeset
205 try
9644
9f7bcc2c3b97 commit https://github.com/vim/vim/commit/6f1d9a096bf22d50c727dca73abbfb8e3ff55176
Christian Brabandt <cb@256bit.org>
parents: 5763
diff changeset
206 let val = s:clojure_is_method_special_case_worker(a:position)
5362
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 4098
diff changeset
207 finally
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 4098
diff changeset
208 call setpos('.', pos)
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 4098
diff changeset
209 endtry
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 4098
diff changeset
210 return val
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 4098
diff changeset
211 endfunction
4098
058f26a834c4 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
212
9644
9f7bcc2c3b97 commit https://github.com/vim/vim/commit/6f1d9a096bf22d50c727dca73abbfb8e3ff55176
Christian Brabandt <cb@256bit.org>
parents: 5763
diff changeset
213 " Check if form is a reader conditional, that is, it is prefixed by #?
26100
babd9f1dbe12 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 23931
diff changeset
214 " or #?@
9644
9f7bcc2c3b97 commit https://github.com/vim/vim/commit/6f1d9a096bf22d50c727dca73abbfb8e3ff55176
Christian Brabandt <cb@256bit.org>
parents: 5763
diff changeset
215 function! s:is_reader_conditional_special_case(position)
23931
5b37a0bf7e3a Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 11518
diff changeset
216 return getline(a:position[0])[a:position[1] - 3 : a:position[1] - 2] == "#?"
26100
babd9f1dbe12 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 23931
diff changeset
217 \|| getline(a:position[0])[a:position[1] - 4 : a:position[1] - 2] == "#?@"
9644
9f7bcc2c3b97 commit https://github.com/vim/vim/commit/6f1d9a096bf22d50c727dca73abbfb8e3ff55176
Christian Brabandt <cb@256bit.org>
parents: 5763
diff changeset
218 endfunction
9f7bcc2c3b97 commit https://github.com/vim/vim/commit/6f1d9a096bf22d50c727dca73abbfb8e3ff55176
Christian Brabandt <cb@256bit.org>
parents: 5763
diff changeset
219
9f7bcc2c3b97 commit https://github.com/vim/vim/commit/6f1d9a096bf22d50c727dca73abbfb8e3ff55176
Christian Brabandt <cb@256bit.org>
parents: 5763
diff changeset
220 " Returns 1 for opening brackets, -1 for _anything else_.
9f7bcc2c3b97 commit https://github.com/vim/vim/commit/6f1d9a096bf22d50c727dca73abbfb8e3ff55176
Christian Brabandt <cb@256bit.org>
parents: 5763
diff changeset
221 function! s:bracket_type(char)
9f7bcc2c3b97 commit https://github.com/vim/vim/commit/6f1d9a096bf22d50c727dca73abbfb8e3ff55176
Christian Brabandt <cb@256bit.org>
parents: 5763
diff changeset
222 return stridx('([{', a:char) > -1 ? 1 : -1
9f7bcc2c3b97 commit https://github.com/vim/vim/commit/6f1d9a096bf22d50c727dca73abbfb8e3ff55176
Christian Brabandt <cb@256bit.org>
parents: 5763
diff changeset
223 endfunction
9f7bcc2c3b97 commit https://github.com/vim/vim/commit/6f1d9a096bf22d50c727dca73abbfb8e3ff55176
Christian Brabandt <cb@256bit.org>
parents: 5763
diff changeset
224
9f7bcc2c3b97 commit https://github.com/vim/vim/commit/6f1d9a096bf22d50c727dca73abbfb8e3ff55176
Christian Brabandt <cb@256bit.org>
parents: 5763
diff changeset
225 " Returns: [opening-bracket-lnum, indent]
9f7bcc2c3b97 commit https://github.com/vim/vim/commit/6f1d9a096bf22d50c727dca73abbfb8e3ff55176
Christian Brabandt <cb@256bit.org>
parents: 5763
diff changeset
226 function! s:clojure_indent_pos()
5362
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 4098
diff changeset
227 " Get rid of special case.
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 4098
diff changeset
228 if line(".") == 1
9644
9f7bcc2c3b97 commit https://github.com/vim/vim/commit/6f1d9a096bf22d50c727dca73abbfb8e3ff55176
Christian Brabandt <cb@256bit.org>
parents: 5763
diff changeset
229 return [0, 0]
5362
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 4098
diff changeset
230 endif
4098
058f26a834c4 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
231
5362
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 4098
diff changeset
232 " We have to apply some heuristics here to figure out, whether to use
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 4098
diff changeset
233 " normal lisp indenting or not.
9644
9f7bcc2c3b97 commit https://github.com/vim/vim/commit/6f1d9a096bf22d50c727dca73abbfb8e3ff55176
Christian Brabandt <cb@256bit.org>
parents: 5763
diff changeset
234 let i = s:check_for_string()
5362
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 4098
diff changeset
235 if i > -1
9644
9f7bcc2c3b97 commit https://github.com/vim/vim/commit/6f1d9a096bf22d50c727dca73abbfb8e3ff55176
Christian Brabandt <cb@256bit.org>
parents: 5763
diff changeset
236 return [0, i + !!g:clojure_align_multiline_strings]
5362
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 4098
diff changeset
237 endif
4098
058f26a834c4 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
238
5362
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 4098
diff changeset
239 call cursor(0, 1)
4098
058f26a834c4 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
240
5362
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 4098
diff changeset
241 " Find the next enclosing [ or {. We can limit the second search
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 4098
diff changeset
242 " to the line, where the [ was found. If no [ was there this is
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 4098
diff changeset
243 " zero and we search for an enclosing {.
9644
9f7bcc2c3b97 commit https://github.com/vim/vim/commit/6f1d9a096bf22d50c727dca73abbfb8e3ff55176
Christian Brabandt <cb@256bit.org>
parents: 5763
diff changeset
244 let paren = s:match_pairs('(', ')', 0)
9f7bcc2c3b97 commit https://github.com/vim/vim/commit/6f1d9a096bf22d50c727dca73abbfb8e3ff55176
Christian Brabandt <cb@256bit.org>
parents: 5763
diff changeset
245 let bracket = s:match_pairs('\[', '\]', paren[0])
9f7bcc2c3b97 commit https://github.com/vim/vim/commit/6f1d9a096bf22d50c727dca73abbfb8e3ff55176
Christian Brabandt <cb@256bit.org>
parents: 5763
diff changeset
246 let curly = s:match_pairs('{', '}', bracket[0])
4098
058f26a834c4 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
247
5362
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 4098
diff changeset
248 " In case the curly brace is on a line later then the [ or - in
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 4098
diff changeset
249 " case they are on the same line - in a higher column, we take the
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 4098
diff changeset
250 " curly indent.
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 4098
diff changeset
251 if curly[0] > bracket[0] || curly[1] > bracket[1]
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 4098
diff changeset
252 if curly[0] > paren[0] || curly[1] > paren[1]
9644
9f7bcc2c3b97 commit https://github.com/vim/vim/commit/6f1d9a096bf22d50c727dca73abbfb8e3ff55176
Christian Brabandt <cb@256bit.org>
parents: 5763
diff changeset
253 return curly
5362
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 4098
diff changeset
254 endif
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 4098
diff changeset
255 endif
4098
058f26a834c4 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
256
5362
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 4098
diff changeset
257 " If the curly was not chosen, we take the bracket indent - if
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 4098
diff changeset
258 " there was one.
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 4098
diff changeset
259 if bracket[0] > paren[0] || bracket[1] > paren[1]
9644
9f7bcc2c3b97 commit https://github.com/vim/vim/commit/6f1d9a096bf22d50c727dca73abbfb8e3ff55176
Christian Brabandt <cb@256bit.org>
parents: 5763
diff changeset
260 return bracket
5362
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 4098
diff changeset
261 endif
4098
058f26a834c4 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
262
5362
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 4098
diff changeset
263 " There are neither { nor [ nor (, ie. we are at the toplevel.
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 4098
diff changeset
264 if paren == [0, 0]
9644
9f7bcc2c3b97 commit https://github.com/vim/vim/commit/6f1d9a096bf22d50c727dca73abbfb8e3ff55176
Christian Brabandt <cb@256bit.org>
parents: 5763
diff changeset
265 return paren
5362
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 4098
diff changeset
266 endif
4098
058f26a834c4 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
267
5362
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 4098
diff changeset
268 " Now we have to reimplement lispindent. This is surprisingly easy, as
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 4098
diff changeset
269 " soon as one has access to syntax items.
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 4098
diff changeset
270 "
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 4098
diff changeset
271 " - Check whether we are in a special position after a word in
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 4098
diff changeset
272 " g:clojure_special_indent_words. These are special cases.
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 4098
diff changeset
273 " - Get the next keyword after the (.
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 4098
diff changeset
274 " - If its first character is also a (, we have another sexp and align
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 4098
diff changeset
275 " one column to the right of the unmatched (.
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 4098
diff changeset
276 " - In case it is in lispwords, we indent the next line to the column of
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 4098
diff changeset
277 " the ( + sw.
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 4098
diff changeset
278 " - If not, we check whether it is last word in the line. In that case
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 4098
diff changeset
279 " we again use ( + sw for indent.
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 4098
diff changeset
280 " - In any other case we use the column of the end of the word + 2.
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 4098
diff changeset
281 call cursor(paren)
4098
058f26a834c4 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
282
9644
9f7bcc2c3b97 commit https://github.com/vim/vim/commit/6f1d9a096bf22d50c727dca73abbfb8e3ff55176
Christian Brabandt <cb@256bit.org>
parents: 5763
diff changeset
283 if s:is_method_special_case(paren)
23931
5b37a0bf7e3a Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 11518
diff changeset
284 return [paren[0], paren[1] + &shiftwidth - 1]
9644
9f7bcc2c3b97 commit https://github.com/vim/vim/commit/6f1d9a096bf22d50c727dca73abbfb8e3ff55176
Christian Brabandt <cb@256bit.org>
parents: 5763
diff changeset
285 endif
9f7bcc2c3b97 commit https://github.com/vim/vim/commit/6f1d9a096bf22d50c727dca73abbfb8e3ff55176
Christian Brabandt <cb@256bit.org>
parents: 5763
diff changeset
286
9f7bcc2c3b97 commit https://github.com/vim/vim/commit/6f1d9a096bf22d50c727dca73abbfb8e3ff55176
Christian Brabandt <cb@256bit.org>
parents: 5763
diff changeset
287 if s:is_reader_conditional_special_case(paren)
9f7bcc2c3b97 commit https://github.com/vim/vim/commit/6f1d9a096bf22d50c727dca73abbfb8e3ff55176
Christian Brabandt <cb@256bit.org>
parents: 5763
diff changeset
288 return paren
5362
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 4098
diff changeset
289 endif
4098
058f26a834c4 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
290
5362
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 4098
diff changeset
291 " In case we are at the last character, we use the paren position.
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 4098
diff changeset
292 if col("$") - 1 == paren[1]
9644
9f7bcc2c3b97 commit https://github.com/vim/vim/commit/6f1d9a096bf22d50c727dca73abbfb8e3ff55176
Christian Brabandt <cb@256bit.org>
parents: 5763
diff changeset
293 return paren
5362
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 4098
diff changeset
294 endif
4098
058f26a834c4 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
295
5362
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 4098
diff changeset
296 " In case after the paren is a whitespace, we search for the next word.
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 4098
diff changeset
297 call cursor(0, col('.') + 1)
9644
9f7bcc2c3b97 commit https://github.com/vim/vim/commit/6f1d9a096bf22d50c727dca73abbfb8e3ff55176
Christian Brabandt <cb@256bit.org>
parents: 5763
diff changeset
298 if s:current_char() == ' '
5362
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 4098
diff changeset
299 call search('\v\S', 'W')
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 4098
diff changeset
300 endif
4098
058f26a834c4 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
301
5362
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 4098
diff changeset
302 " If we moved to another line, there is no word after the (. We
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 4098
diff changeset
303 " use the ( position for indent.
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 4098
diff changeset
304 if line(".") > paren[0]
9644
9f7bcc2c3b97 commit https://github.com/vim/vim/commit/6f1d9a096bf22d50c727dca73abbfb8e3ff55176
Christian Brabandt <cb@256bit.org>
parents: 5763
diff changeset
305 return paren
5362
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 4098
diff changeset
306 endif
4098
058f26a834c4 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
307
5362
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 4098
diff changeset
308 " We still have to check, whether the keyword starts with a (, [ or {.
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 4098
diff changeset
309 " In that case we use the ( position for indent.
9644
9f7bcc2c3b97 commit https://github.com/vim/vim/commit/6f1d9a096bf22d50c727dca73abbfb8e3ff55176
Christian Brabandt <cb@256bit.org>
parents: 5763
diff changeset
310 let w = s:current_word()
9f7bcc2c3b97 commit https://github.com/vim/vim/commit/6f1d9a096bf22d50c727dca73abbfb8e3ff55176
Christian Brabandt <cb@256bit.org>
parents: 5763
diff changeset
311 if s:bracket_type(w[0]) == 1
9f7bcc2c3b97 commit https://github.com/vim/vim/commit/6f1d9a096bf22d50c727dca73abbfb8e3ff55176
Christian Brabandt <cb@256bit.org>
parents: 5763
diff changeset
312 return paren
5362
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 4098
diff changeset
313 endif
4098
058f26a834c4 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
314
23931
5b37a0bf7e3a Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 11518
diff changeset
315 " If the keyword begins with #, check if it is an anonymous
5b37a0bf7e3a Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 11518
diff changeset
316 " function or set, in which case we indent by the shiftwidth
5b37a0bf7e3a Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 11518
diff changeset
317 " (minus one if g:clojure_align_subforms = 1), or if it is
5b37a0bf7e3a Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 11518
diff changeset
318 " ignored, in which case we use the ( position for indent.
5b37a0bf7e3a Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 11518
diff changeset
319 if w[0] == "#"
5b37a0bf7e3a Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 11518
diff changeset
320 " TODO: Handle #=() and other rare reader invocations?
5b37a0bf7e3a Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 11518
diff changeset
321 if w[1] == '(' || w[1] == '{'
5b37a0bf7e3a Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 11518
diff changeset
322 return [paren[0], paren[1] + (g:clojure_align_subforms ? 0 : &shiftwidth - 1)]
5b37a0bf7e3a Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 11518
diff changeset
323 elseif w[1] == '_'
5b37a0bf7e3a Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 11518
diff changeset
324 return paren
5b37a0bf7e3a Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 11518
diff changeset
325 endif
5b37a0bf7e3a Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 11518
diff changeset
326 endif
5b37a0bf7e3a Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 11518
diff changeset
327
5362
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 4098
diff changeset
328 " Test words without namespace qualifiers and leading reader macro
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 4098
diff changeset
329 " metacharacters.
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 4098
diff changeset
330 "
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 4098
diff changeset
331 " e.g. clojure.core/defn and #'defn should both indent like defn.
9644
9f7bcc2c3b97 commit https://github.com/vim/vim/commit/6f1d9a096bf22d50c727dca73abbfb8e3ff55176
Christian Brabandt <cb@256bit.org>
parents: 5763
diff changeset
332 let ww = s:strip_namespace_and_macro_chars(w)
4098
058f26a834c4 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
333
5763
c52a655d927d Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5734
diff changeset
334 if &lispwords =~# '\V\<' . ww . '\>'
23931
5b37a0bf7e3a Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 11518
diff changeset
335 return [paren[0], paren[1] + &shiftwidth - 1]
5362
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 4098
diff changeset
336 endif
4098
058f26a834c4 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
337
5362
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 4098
diff changeset
338 if g:clojure_fuzzy_indent
9644
9f7bcc2c3b97 commit https://github.com/vim/vim/commit/6f1d9a096bf22d50c727dca73abbfb8e3ff55176
Christian Brabandt <cb@256bit.org>
parents: 5763
diff changeset
339 \ && !s:match_one(g:clojure_fuzzy_indent_blacklist, ww)
9f7bcc2c3b97 commit https://github.com/vim/vim/commit/6f1d9a096bf22d50c727dca73abbfb8e3ff55176
Christian Brabandt <cb@256bit.org>
parents: 5763
diff changeset
340 \ && s:match_one(g:clojure_fuzzy_indent_patterns, ww)
23931
5b37a0bf7e3a Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 11518
diff changeset
341 return [paren[0], paren[1] + &shiftwidth - 1]
5362
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 4098
diff changeset
342 endif
4098
058f26a834c4 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
343
5362
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 4098
diff changeset
344 call search('\v\_s', 'cW')
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 4098
diff changeset
345 call search('\v\S', 'W')
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 4098
diff changeset
346 if paren[0] < line(".")
23931
5b37a0bf7e3a Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 11518
diff changeset
347 return [paren[0], paren[1] + (g:clojure_align_subforms ? 0 : &shiftwidth - 1)]
5362
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 4098
diff changeset
348 endif
4098
058f26a834c4 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
349
5362
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 4098
diff changeset
350 call search('\v\S', 'bW')
9644
9f7bcc2c3b97 commit https://github.com/vim/vim/commit/6f1d9a096bf22d50c727dca73abbfb8e3ff55176
Christian Brabandt <cb@256bit.org>
parents: 5763
diff changeset
351 return [line('.'), col('.') + 1]
9f7bcc2c3b97 commit https://github.com/vim/vim/commit/6f1d9a096bf22d50c727dca73abbfb8e3ff55176
Christian Brabandt <cb@256bit.org>
parents: 5763
diff changeset
352 endfunction
9f7bcc2c3b97 commit https://github.com/vim/vim/commit/6f1d9a096bf22d50c727dca73abbfb8e3ff55176
Christian Brabandt <cb@256bit.org>
parents: 5763
diff changeset
353
9f7bcc2c3b97 commit https://github.com/vim/vim/commit/6f1d9a096bf22d50c727dca73abbfb8e3ff55176
Christian Brabandt <cb@256bit.org>
parents: 5763
diff changeset
354 function! GetClojureIndent()
9f7bcc2c3b97 commit https://github.com/vim/vim/commit/6f1d9a096bf22d50c727dca73abbfb8e3ff55176
Christian Brabandt <cb@256bit.org>
parents: 5763
diff changeset
355 let lnum = line('.')
9f7bcc2c3b97 commit https://github.com/vim/vim/commit/6f1d9a096bf22d50c727dca73abbfb8e3ff55176
Christian Brabandt <cb@256bit.org>
parents: 5763
diff changeset
356 let orig_lnum = lnum
9f7bcc2c3b97 commit https://github.com/vim/vim/commit/6f1d9a096bf22d50c727dca73abbfb8e3ff55176
Christian Brabandt <cb@256bit.org>
parents: 5763
diff changeset
357 let orig_col = col('.')
9f7bcc2c3b97 commit https://github.com/vim/vim/commit/6f1d9a096bf22d50c727dca73abbfb8e3ff55176
Christian Brabandt <cb@256bit.org>
parents: 5763
diff changeset
358 let [opening_lnum, indent] = s:clojure_indent_pos()
9f7bcc2c3b97 commit https://github.com/vim/vim/commit/6f1d9a096bf22d50c727dca73abbfb8e3ff55176
Christian Brabandt <cb@256bit.org>
parents: 5763
diff changeset
359
9f7bcc2c3b97 commit https://github.com/vim/vim/commit/6f1d9a096bf22d50c727dca73abbfb8e3ff55176
Christian Brabandt <cb@256bit.org>
parents: 5763
diff changeset
360 " Account for multibyte characters
9f7bcc2c3b97 commit https://github.com/vim/vim/commit/6f1d9a096bf22d50c727dca73abbfb8e3ff55176
Christian Brabandt <cb@256bit.org>
parents: 5763
diff changeset
361 if opening_lnum > 0
9f7bcc2c3b97 commit https://github.com/vim/vim/commit/6f1d9a096bf22d50c727dca73abbfb8e3ff55176
Christian Brabandt <cb@256bit.org>
parents: 5763
diff changeset
362 let indent -= indent - virtcol([opening_lnum, indent])
9f7bcc2c3b97 commit https://github.com/vim/vim/commit/6f1d9a096bf22d50c727dca73abbfb8e3ff55176
Christian Brabandt <cb@256bit.org>
parents: 5763
diff changeset
363 endif
9f7bcc2c3b97 commit https://github.com/vim/vim/commit/6f1d9a096bf22d50c727dca73abbfb8e3ff55176
Christian Brabandt <cb@256bit.org>
parents: 5763
diff changeset
364
9f7bcc2c3b97 commit https://github.com/vim/vim/commit/6f1d9a096bf22d50c727dca73abbfb8e3ff55176
Christian Brabandt <cb@256bit.org>
parents: 5763
diff changeset
365 " Return if there are no previous lines to inherit from
9f7bcc2c3b97 commit https://github.com/vim/vim/commit/6f1d9a096bf22d50c727dca73abbfb8e3ff55176
Christian Brabandt <cb@256bit.org>
parents: 5763
diff changeset
366 if opening_lnum < 1 || opening_lnum >= lnum - 1
9f7bcc2c3b97 commit https://github.com/vim/vim/commit/6f1d9a096bf22d50c727dca73abbfb8e3ff55176
Christian Brabandt <cb@256bit.org>
parents: 5763
diff changeset
367 call cursor(orig_lnum, orig_col)
9f7bcc2c3b97 commit https://github.com/vim/vim/commit/6f1d9a096bf22d50c727dca73abbfb8e3ff55176
Christian Brabandt <cb@256bit.org>
parents: 5763
diff changeset
368 return indent
9f7bcc2c3b97 commit https://github.com/vim/vim/commit/6f1d9a096bf22d50c727dca73abbfb8e3ff55176
Christian Brabandt <cb@256bit.org>
parents: 5763
diff changeset
369 endif
9f7bcc2c3b97 commit https://github.com/vim/vim/commit/6f1d9a096bf22d50c727dca73abbfb8e3ff55176
Christian Brabandt <cb@256bit.org>
parents: 5763
diff changeset
370
9f7bcc2c3b97 commit https://github.com/vim/vim/commit/6f1d9a096bf22d50c727dca73abbfb8e3ff55176
Christian Brabandt <cb@256bit.org>
parents: 5763
diff changeset
371 let bracket_count = 0
9f7bcc2c3b97 commit https://github.com/vim/vim/commit/6f1d9a096bf22d50c727dca73abbfb8e3ff55176
Christian Brabandt <cb@256bit.org>
parents: 5763
diff changeset
372
9f7bcc2c3b97 commit https://github.com/vim/vim/commit/6f1d9a096bf22d50c727dca73abbfb8e3ff55176
Christian Brabandt <cb@256bit.org>
parents: 5763
diff changeset
373 " Take the indent of the first previous non-white line that is
9f7bcc2c3b97 commit https://github.com/vim/vim/commit/6f1d9a096bf22d50c727dca73abbfb8e3ff55176
Christian Brabandt <cb@256bit.org>
parents: 5763
diff changeset
374 " at the same sexp level. cf. src/misc1.c:get_lisp_indent()
9f7bcc2c3b97 commit https://github.com/vim/vim/commit/6f1d9a096bf22d50c727dca73abbfb8e3ff55176
Christian Brabandt <cb@256bit.org>
parents: 5763
diff changeset
375 while 1
9f7bcc2c3b97 commit https://github.com/vim/vim/commit/6f1d9a096bf22d50c727dca73abbfb8e3ff55176
Christian Brabandt <cb@256bit.org>
parents: 5763
diff changeset
376 let lnum = prevnonblank(lnum - 1)
9f7bcc2c3b97 commit https://github.com/vim/vim/commit/6f1d9a096bf22d50c727dca73abbfb8e3ff55176
Christian Brabandt <cb@256bit.org>
parents: 5763
diff changeset
377 let col = 1
9f7bcc2c3b97 commit https://github.com/vim/vim/commit/6f1d9a096bf22d50c727dca73abbfb8e3ff55176
Christian Brabandt <cb@256bit.org>
parents: 5763
diff changeset
378
9f7bcc2c3b97 commit https://github.com/vim/vim/commit/6f1d9a096bf22d50c727dca73abbfb8e3ff55176
Christian Brabandt <cb@256bit.org>
parents: 5763
diff changeset
379 if lnum <= opening_lnum
9f7bcc2c3b97 commit https://github.com/vim/vim/commit/6f1d9a096bf22d50c727dca73abbfb8e3ff55176
Christian Brabandt <cb@256bit.org>
parents: 5763
diff changeset
380 break
9f7bcc2c3b97 commit https://github.com/vim/vim/commit/6f1d9a096bf22d50c727dca73abbfb8e3ff55176
Christian Brabandt <cb@256bit.org>
parents: 5763
diff changeset
381 endif
9f7bcc2c3b97 commit https://github.com/vim/vim/commit/6f1d9a096bf22d50c727dca73abbfb8e3ff55176
Christian Brabandt <cb@256bit.org>
parents: 5763
diff changeset
382
9f7bcc2c3b97 commit https://github.com/vim/vim/commit/6f1d9a096bf22d50c727dca73abbfb8e3ff55176
Christian Brabandt <cb@256bit.org>
parents: 5763
diff changeset
383 call cursor(lnum, col)
9f7bcc2c3b97 commit https://github.com/vim/vim/commit/6f1d9a096bf22d50c727dca73abbfb8e3ff55176
Christian Brabandt <cb@256bit.org>
parents: 5763
diff changeset
384
9f7bcc2c3b97 commit https://github.com/vim/vim/commit/6f1d9a096bf22d50c727dca73abbfb8e3ff55176
Christian Brabandt <cb@256bit.org>
parents: 5763
diff changeset
385 " Handle bracket counting edge case
9f7bcc2c3b97 commit https://github.com/vim/vim/commit/6f1d9a096bf22d50c727dca73abbfb8e3ff55176
Christian Brabandt <cb@256bit.org>
parents: 5763
diff changeset
386 if s:is_paren()
9f7bcc2c3b97 commit https://github.com/vim/vim/commit/6f1d9a096bf22d50c727dca73abbfb8e3ff55176
Christian Brabandt <cb@256bit.org>
parents: 5763
diff changeset
387 let bracket_count += s:bracket_type(s:current_char())
9f7bcc2c3b97 commit https://github.com/vim/vim/commit/6f1d9a096bf22d50c727dca73abbfb8e3ff55176
Christian Brabandt <cb@256bit.org>
parents: 5763
diff changeset
388 endif
9f7bcc2c3b97 commit https://github.com/vim/vim/commit/6f1d9a096bf22d50c727dca73abbfb8e3ff55176
Christian Brabandt <cb@256bit.org>
parents: 5763
diff changeset
389
9f7bcc2c3b97 commit https://github.com/vim/vim/commit/6f1d9a096bf22d50c727dca73abbfb8e3ff55176
Christian Brabandt <cb@256bit.org>
parents: 5763
diff changeset
390 while 1
9f7bcc2c3b97 commit https://github.com/vim/vim/commit/6f1d9a096bf22d50c727dca73abbfb8e3ff55176
Christian Brabandt <cb@256bit.org>
parents: 5763
diff changeset
391 if search('\v[(\[{}\])]', '', lnum) < 1
9f7bcc2c3b97 commit https://github.com/vim/vim/commit/6f1d9a096bf22d50c727dca73abbfb8e3ff55176
Christian Brabandt <cb@256bit.org>
parents: 5763
diff changeset
392 break
9f7bcc2c3b97 commit https://github.com/vim/vim/commit/6f1d9a096bf22d50c727dca73abbfb8e3ff55176
Christian Brabandt <cb@256bit.org>
parents: 5763
diff changeset
393 elseif !s:ignored_region()
9f7bcc2c3b97 commit https://github.com/vim/vim/commit/6f1d9a096bf22d50c727dca73abbfb8e3ff55176
Christian Brabandt <cb@256bit.org>
parents: 5763
diff changeset
394 let bracket_count += s:bracket_type(s:current_char())
9f7bcc2c3b97 commit https://github.com/vim/vim/commit/6f1d9a096bf22d50c727dca73abbfb8e3ff55176
Christian Brabandt <cb@256bit.org>
parents: 5763
diff changeset
395 endif
9f7bcc2c3b97 commit https://github.com/vim/vim/commit/6f1d9a096bf22d50c727dca73abbfb8e3ff55176
Christian Brabandt <cb@256bit.org>
parents: 5763
diff changeset
396 endwhile
9f7bcc2c3b97 commit https://github.com/vim/vim/commit/6f1d9a096bf22d50c727dca73abbfb8e3ff55176
Christian Brabandt <cb@256bit.org>
parents: 5763
diff changeset
397
9f7bcc2c3b97 commit https://github.com/vim/vim/commit/6f1d9a096bf22d50c727dca73abbfb8e3ff55176
Christian Brabandt <cb@256bit.org>
parents: 5763
diff changeset
398 if bracket_count == 0
9f7bcc2c3b97 commit https://github.com/vim/vim/commit/6f1d9a096bf22d50c727dca73abbfb8e3ff55176
Christian Brabandt <cb@256bit.org>
parents: 5763
diff changeset
399 " Check if this is part of a multiline string
9f7bcc2c3b97 commit https://github.com/vim/vim/commit/6f1d9a096bf22d50c727dca73abbfb8e3ff55176
Christian Brabandt <cb@256bit.org>
parents: 5763
diff changeset
400 call cursor(lnum, 1)
9f7bcc2c3b97 commit https://github.com/vim/vim/commit/6f1d9a096bf22d50c727dca73abbfb8e3ff55176
Christian Brabandt <cb@256bit.org>
parents: 5763
diff changeset
401 if s:syn_id_name() !~? '\vstring|regex'
9f7bcc2c3b97 commit https://github.com/vim/vim/commit/6f1d9a096bf22d50c727dca73abbfb8e3ff55176
Christian Brabandt <cb@256bit.org>
parents: 5763
diff changeset
402 call cursor(orig_lnum, orig_col)
9f7bcc2c3b97 commit https://github.com/vim/vim/commit/6f1d9a096bf22d50c727dca73abbfb8e3ff55176
Christian Brabandt <cb@256bit.org>
parents: 5763
diff changeset
403 return indent(lnum)
9f7bcc2c3b97 commit https://github.com/vim/vim/commit/6f1d9a096bf22d50c727dca73abbfb8e3ff55176
Christian Brabandt <cb@256bit.org>
parents: 5763
diff changeset
404 endif
9f7bcc2c3b97 commit https://github.com/vim/vim/commit/6f1d9a096bf22d50c727dca73abbfb8e3ff55176
Christian Brabandt <cb@256bit.org>
parents: 5763
diff changeset
405 endif
9f7bcc2c3b97 commit https://github.com/vim/vim/commit/6f1d9a096bf22d50c727dca73abbfb8e3ff55176
Christian Brabandt <cb@256bit.org>
parents: 5763
diff changeset
406 endwhile
9f7bcc2c3b97 commit https://github.com/vim/vim/commit/6f1d9a096bf22d50c727dca73abbfb8e3ff55176
Christian Brabandt <cb@256bit.org>
parents: 5763
diff changeset
407
9f7bcc2c3b97 commit https://github.com/vim/vim/commit/6f1d9a096bf22d50c727dca73abbfb8e3ff55176
Christian Brabandt <cb@256bit.org>
parents: 5763
diff changeset
408 call cursor(orig_lnum, orig_col)
9f7bcc2c3b97 commit https://github.com/vim/vim/commit/6f1d9a096bf22d50c727dca73abbfb8e3ff55176
Christian Brabandt <cb@256bit.org>
parents: 5763
diff changeset
409 return indent
5362
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 4098
diff changeset
410 endfunction
4098
058f26a834c4 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
411
5362
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 4098
diff changeset
412 setlocal indentexpr=GetClojureIndent()
4098
058f26a834c4 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
413
058f26a834c4 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
414 else
058f26a834c4 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
415
5362
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 4098
diff changeset
416 " In case we have searchpairpos not available we fall back to
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 4098
diff changeset
417 " normal lisp indenting.
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 4098
diff changeset
418 setlocal indentexpr=
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 4098
diff changeset
419 setlocal lisp
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 4098
diff changeset
420 let b:undo_indent .= '| setlocal lisp<'
4098
058f26a834c4 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
421
058f26a834c4 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
422 endif
058f26a834c4 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
423
058f26a834c4 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
424 let &cpo = s:save_cpo
058f26a834c4 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
425 unlet! s:save_cpo
058f26a834c4 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
426
5362
ab1508486b12 Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents: 4098
diff changeset
427 " vim:sts=8:sw=8:ts=8:noet