annotate runtime/indent/julia.vim @ 30007:4123e4bd1708 v9.0.0341

patch 9.0.0341: mapset() does not restore <Nop> mapping properly Commit: https://github.com/vim/vim/commit/92a3d20682d46359bb50a452b4f831659e799155 Author: zeertzjq <zeertzjq@outlook.com> Date: Wed Aug 31 16:40:17 2022 +0100 patch 9.0.0341: mapset() does not restore <Nop> mapping properly Problem: mapset() does not restore <Nop> mapping properly. Solution: Use an empty string for <Nop>. (closes https://github.com/vim/vim/issues/11022)
author Bram Moolenaar <Bram@vim.org>
date Wed, 31 Aug 2022 17:45:03 +0200
parents 1e9e9d89f0ee
children 5c220cf30f1f
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
25619
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1 " Vim indent file
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2 " Language: Julia
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3 " Maintainer: Carlo Baldassi <carlobaldassi@gmail.com>
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
4 " Homepage: https://github.com/JuliaEditorSupport/julia-vim
29193
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25619
diff changeset
5 " Last Change: 2022 Jun 14
25619
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
6 " Notes: originally based on Bram Molenaar's indent file for vim
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
7
29193
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25619
diff changeset
8 " Only load this indent file when no other was loaded.
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25619
diff changeset
9 if exists("b:did_indent")
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25619
diff changeset
10 finish
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25619
diff changeset
11 endif
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25619
diff changeset
12 let b:did_indent = 1
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25619
diff changeset
13
25619
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
14 setlocal autoindent
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
15
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
16 setlocal indentexpr=GetJuliaIndent()
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
17 setlocal indentkeys+==end,=else,=catch,=finally,),],}
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
18 setlocal indentkeys-=0#
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
19 setlocal indentkeys-=:
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
20 setlocal indentkeys-=0{
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
21 setlocal indentkeys-=0}
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
22 setlocal nosmartindent
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
23
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
24 " Only define the function once.
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
25 if exists("*GetJuliaIndent")
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
26 finish
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
27 endif
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
28
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
29 let s:skipPatternsBasic = '\<julia\%(Comment\%([LM]\|Delim\)\)\>'
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
30 let s:skipPatterns = '\<julia\%(Comprehension\%(For\|If\)\|RangeKeyword\|Comment\%([LM]\|Delim\)\|\%([bs]\|Shell\|Printf\|Doc\)\?String\|StringPrefixed\|DocStringM\(Raw\)\?\|RegEx\|SymbolS\?\|Macro\|Dotted\)\>'
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
31
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
32 function JuliaMatch(lnum, str, regex, st, ...)
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
33 let s = a:st
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
34 let e = a:0 > 0 ? a:1 : -1
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
35 let basic_skip = a:0 > 1 ? a:2 : 'all'
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
36 let skip = basic_skip ==# 'basic' ? s:skipPatternsBasic : s:skipPatterns
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
37 while 1
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
38 let f = match(a:str, '\C' . a:regex, s)
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
39 if e >= 0 && f >= e
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
40 return -1
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
41 endif
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
42 if f >= 0
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
43 let attr = synIDattr(synID(a:lnum,f+1,1),"name")
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
44 let attrT = synIDattr(synID(a:lnum,f+1,0),"name")
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
45 if attr =~# skip || attrT =~# skip
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
46 let s = f+1
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
47 continue
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
48 endif
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
49 endif
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
50 break
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
51 endwhile
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
52 return f
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
53 endfunction
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
54
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
55 function GetJuliaNestingStruct(lnum, ...)
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
56 " Auxiliary function to inspect the block structure of a line
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
57 let line = getline(a:lnum)
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
58 let s = a:0 > 0 ? a:1 : 0
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
59 let e = a:0 > 1 ? a:2 : -1
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
60 let blocks_stack = []
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
61 let num_closed_blocks = 0
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
62 while 1
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
63 let fb = JuliaMatch(a:lnum, line, '\<\%(if\|else\%(if\)\?\|while\|for\|try\|catch\|finally\|\%(staged\)\?function\|macro\|begin\|mutable\s\+struct\|\%(mutable\s\+\)\@<!struct\|\%(abstract\|primitive\)\s\+type\|let\|\%(bare\)\?module\|quote\|do\)\>', s, e)
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
64 let fe = JuliaMatch(a:lnum, line, '\<end\>', s, e)
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
65
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
66 if fb < 0 && fe < 0
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
67 " No blocks found
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
68 break
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
69 end
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
70
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
71 if fb >= 0 && (fb < fe || fe < 0)
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
72 " The first occurrence is an opening block keyword
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
73 " Note: some keywords (elseif,else,catch,finally) are both
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
74 " closing blocks and opening new ones
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
75
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
76 let i = JuliaMatch(a:lnum, line, '\<if\>', s)
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
77 if i >= 0 && i == fb
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
78 let s = i+1
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
79 call add(blocks_stack, 'if')
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
80 continue
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
81 endif
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
82 let i = JuliaMatch(a:lnum, line, '\<elseif\>', s)
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
83 if i >= 0 && i == fb
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
84 let s = i+1
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
85 if len(blocks_stack) > 0 && blocks_stack[-1] == 'if'
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
86 let blocks_stack[-1] = 'elseif'
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
87 elseif (len(blocks_stack) > 0 && blocks_stack[-1] != 'elseif') || len(blocks_stack) == 0
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
88 call add(blocks_stack, 'elseif')
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
89 let num_closed_blocks += 1
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
90 endif
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
91 continue
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
92 endif
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
93 let i = JuliaMatch(a:lnum, line, '\<else\>', s)
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
94 if i >= 0 && i == fb
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
95 let s = i+1
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
96 if len(blocks_stack) > 0 && blocks_stack[-1] =~# '\<\%(else\)\=if\>'
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
97 let blocks_stack[-1] = 'else'
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
98 else
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
99 call add(blocks_stack, 'else')
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
100 let num_closed_blocks += 1
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
101 endif
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
102 continue
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
103 endif
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
104
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
105 let i = JuliaMatch(a:lnum, line, '\<try\>', s)
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
106 if i >= 0 && i == fb
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
107 let s = i+1
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
108 call add(blocks_stack, 'try')
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
109 continue
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
110 endif
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
111 let i = JuliaMatch(a:lnum, line, '\<catch\>', s)
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
112 if i >= 0 && i == fb
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
113 let s = i+1
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
114 if len(blocks_stack) > 0 && blocks_stack[-1] == 'try'
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
115 let blocks_stack[-1] = 'catch'
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
116 else
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
117 call add(blocks_stack, 'catch')
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
118 let num_closed_blocks += 1
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
119 endif
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
120 continue
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
121 endif
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
122 let i = JuliaMatch(a:lnum, line, '\<finally\>', s)
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
123 if i >= 0 && i == fb
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
124 let s = i+1
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
125 if len(blocks_stack) > 0 && (blocks_stack[-1] == 'try' || blocks_stack[-1] == 'catch')
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
126 let blocks_stack[-1] = 'finally'
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
127 else
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
128 call add(blocks_stack, 'finally')
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
129 let num_closed_blocks += 1
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
130 endif
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
131 continue
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
132 endif
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
133
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
134 let i = JuliaMatch(a:lnum, line, '\<\%(bare\)\?module\>', s)
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
135 if i >= 0 && i == fb
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
136 let s = i+1
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
137 if i == 0
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
138 call add(blocks_stack, 'col1module')
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
139 else
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
140 call add(blocks_stack, 'other')
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
141 endif
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
142 continue
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
143 endif
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
144
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
145 let i = JuliaMatch(a:lnum, line, '\<\%(while\|for\|function\|macro\|begin\|\%(mutable\s\+\)\?struct\|\%(abstract\|primitive\)\s\+type\|let\|quote\|do\)\>', s)
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
146 if i >= 0 && i == fb
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
147 if match(line, '\C\<\%(mutable\|abstract\|primitive\)', i) != -1
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
148 let s = i+11
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
149 else
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
150 let s = i+1
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
151 endif
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
152 call add(blocks_stack, 'other')
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
153 continue
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
154 endif
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
155
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
156 " Note: it should be impossible to get here
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
157 break
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
158
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
159 else
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
160 " The first occurrence is an 'end'
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
161
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
162 let s = fe+1
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
163 if len(blocks_stack) == 0
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
164 let num_closed_blocks += 1
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
165 else
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
166 call remove(blocks_stack, -1)
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
167 endif
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
168 continue
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
169
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
170 endif
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
171
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
172 " Note: it should be impossible to get here
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
173 break
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
174 endwhile
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
175 let num_open_blocks = len(blocks_stack) - count(blocks_stack, 'col1module')
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
176 return [num_open_blocks, num_closed_blocks]
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
177 endfunction
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
178
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
179 function GetJuliaNestingBrackets(lnum, c)
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
180 " Auxiliary function to inspect the brackets structure of a line
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
181 let line = getline(a:lnum)[0 : (a:c - 1)]
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
182 let s = 0
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
183 let brackets_stack = []
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
184 let last_closed_bracket = -1
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
185 while 1
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
186 let fb = JuliaMatch(a:lnum, line, '[([{]', s)
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
187 let fe = JuliaMatch(a:lnum, line, '[])}]', s)
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
188
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
189 if fb < 0 && fe < 0
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
190 " No brackets found
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
191 break
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
192 end
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
193
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
194 if fb >= 0 && (fb < fe || fe < 0)
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
195 " The first occurrence is an opening bracket
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
196
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
197 let i = JuliaMatch(a:lnum, line, '(', s)
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
198 if i >= 0 && i == fb
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
199 let s = i+1
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
200 call add(brackets_stack, ['par',i])
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
201 continue
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
202 endif
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
203
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
204 let i = JuliaMatch(a:lnum, line, '\[', s)
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
205 if i >= 0 && i == fb
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
206 let s = i+1
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
207 call add(brackets_stack, ['sqbra',i])
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
208 continue
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
209 endif
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
210
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
211 let i = JuliaMatch(a:lnum, line, '{', s)
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
212 if i >= 0 && i == fb
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
213 let s = i+1
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
214 call add(brackets_stack, ['curbra',i])
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
215 continue
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
216 endif
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
217
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
218 " Note: it should be impossible to get here
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
219 break
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
220
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
221 else
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
222 " The first occurrence is a closing bracket
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
223
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
224 let i = JuliaMatch(a:lnum, line, ')', s)
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
225 if i >= 0 && i == fe
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
226 let s = i+1
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
227 if len(brackets_stack) > 0 && brackets_stack[-1][0] == 'par'
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
228 call remove(brackets_stack, -1)
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
229 else
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
230 let last_closed_bracket = i + 1
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
231 endif
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
232 continue
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
233 endif
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
234
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
235 let i = JuliaMatch(a:lnum, line, ']', s)
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
236 if i >= 0 && i == fe
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
237 let s = i+1
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
238 if len(brackets_stack) > 0 && brackets_stack[-1][0] == 'sqbra'
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
239 call remove(brackets_stack, -1)
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
240 else
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
241 let last_closed_bracket = i + 1
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
242 endif
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
243 continue
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
244 endif
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
245
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
246 let i = JuliaMatch(a:lnum, line, '}', s)
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
247 if i >= 0 && i == fe
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
248 let s = i+1
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
249 if len(brackets_stack) > 0 && brackets_stack[-1][0] == 'curbra'
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
250 call remove(brackets_stack, -1)
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
251 else
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
252 let last_closed_bracket = i + 1
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
253 endif
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
254 continue
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
255 endif
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
256
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
257 " Note: it should be impossible to get here
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
258 break
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
259
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
260 endif
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
261
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
262 " Note: it should be impossible to get here
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
263 break
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
264 endwhile
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
265 let first_open_bracket = -1
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
266 let last_open_bracket = -1
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
267 let infuncargs = 0
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
268 if len(brackets_stack) > 0
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
269 let first_open_bracket = brackets_stack[0][1]
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
270 let last_open_bracket = brackets_stack[-1][1]
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
271 if brackets_stack[-1][0] == 'par' && IsFunctionArgPar(a:lnum, last_open_bracket+1)
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
272 let infuncargs = 1
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
273 endif
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
274 endif
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
275 return [first_open_bracket, last_open_bracket, last_closed_bracket, infuncargs]
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
276 endfunction
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
277
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
278 let s:bracketBlocks = '\<julia\%(\%(\%(Printf\)\?Par\|SqBra\%(Idx\)\?\|CurBra\)Block\|ParBlockInRange\|StringVars\%(Par\|SqBra\|CurBra\)\|Dollar\%(Par\|SqBra\)\|QuotedParBlockS\?\)\>'
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
279
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
280 function IsInBrackets(lnum, c)
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
281 let stack = map(synstack(a:lnum, a:c), 'synIDattr(v:val, "name")')
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
282 call filter(stack, 'v:val =~# s:bracketBlocks')
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
283 return len(stack) > 0
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
284 endfunction
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
285
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
286 function IsInDocString(lnum)
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
287 let stack = map(synstack(a:lnum, 1), 'synIDattr(v:val, "name")')
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
288 call filter(stack, 'v:val =~# "\\<juliaDocString\\(Delim\\|M\\\(Raw\\)\\?\\)\\?\\>"')
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
289 return len(stack) > 0
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
290 endfunction
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
291
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
292 function IsInContinuationImportLine(lnum)
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
293 let stack = map(synstack(a:lnum, 1), 'synIDattr(v:val, "name")')
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
294 call filter(stack, 'v:val =~# "\\<juliaImportLine\\>"')
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
295 if len(stack) == 0
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
296 return 0
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
297 endif
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
298 return JuliaMatch(a:lnum, getline(a:lnum), '\<\%(import\|using\|export\)\>', indent(a:lnum)) == -1
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
299 endfunction
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
300
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
301 function IsFunctionArgPar(lnum, c)
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
302 if a:c == 0
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
303 return 0
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
304 endif
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
305 let stack = map(synstack(a:lnum, a:c-1), 'synIDattr(v:val, "name")')
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
306 return len(stack) >= 2 && stack[-2] ==# 'juliaFunctionDef'
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
307 endfunction
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
308
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
309 function JumpToMatch(lnum, last_closed_bracket)
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
310 " we use the % command to skip back (tries to ues matchit if possible,
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
311 " otherwise resorts to vim's default, which is buggy but better than
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
312 " nothing)
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
313 call cursor(a:lnum, a:last_closed_bracket)
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
314 let percmap = maparg("%", "n")
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
315 if exists("g:loaded_matchit") && percmap =~# 'Match\%(it\|_wrapper\)'
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
316 normal %
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
317 else
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
318 normal! %
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
319 end
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
320 endfunction
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
321
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
322 " Auxiliary function to find a line which does not start in the middle of a
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
323 " multiline bracketed expression, to be used as reference for block
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
324 " indentation.
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
325 function LastBlockIndent(lnum)
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
326 let lnum = a:lnum
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
327 let ind = 0
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
328 while lnum > 0
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
329 let ind = indent(lnum)
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
330 if ind == 0
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
331 return [lnum, 0]
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
332 endif
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
333 if !IsInBrackets(lnum, 1)
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
334 break
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
335 endif
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
336 let lnum = prevnonblank(lnum - 1)
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
337 endwhile
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
338 return [max([lnum,1]), ind]
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
339 endfunction
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
340
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
341 function GetJuliaIndent()
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
342 " Do not alter doctrings indentation
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
343 if IsInDocString(v:lnum)
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
344 return -1
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
345 endif
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
346
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
347 " Find a non-blank line above the current line.
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
348 let lnum = prevnonblank(v:lnum - 1)
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
349
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
350 " At the start of the file use zero indent.
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
351 if lnum == 0
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
352 return 0
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
353 endif
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
354
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
355 let ind = -1
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
356 let st = -1
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
357 let lim = -1
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
358
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
359 " Multiline bracketed expressions take precedence
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
360 let align_brackets = get(g:, "julia_indent_align_brackets", 1)
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
361 let align_funcargs = get(g:, "julia_indent_align_funcargs", 0)
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
362 let c = len(getline(lnum)) + 1
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
363 while IsInBrackets(lnum, c)
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
364 let [first_open_bracket, last_open_bracket, last_closed_bracket, infuncargs] = GetJuliaNestingBrackets(lnum, c)
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
365
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
366 " First scenario: the previous line has a hanging open bracket:
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
367 " set the indentation to match the opening bracket (plus an extra space)
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
368 " unless we're in a function arguments list or alignment is disabled, in
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
369 " which case we just add an extra indent
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
370 if last_open_bracket != -1
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
371 if (!infuncargs && align_brackets) || (infuncargs && align_funcargs)
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
372 let st = last_open_bracket
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
373 let ind = virtcol([lnum, st + 1])
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
374 else
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
375 let ind = indent(lnum) + shiftwidth()
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
376 endif
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
377
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
378 " Second scenario: some multiline bracketed expression was closed in the
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
379 " previous line. But since we know we are still in a bracketed expression,
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
380 " we need to find the line where the bracket was opened
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
381 elseif last_closed_bracket != -1
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
382 call JumpToMatch(lnum, last_closed_bracket)
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
383 if line(".") == lnum
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
384 " something wrong here, give up
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
385 let ind = indent(lnum)
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
386 else
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
387 let lnum = line(".")
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
388 let c = col(".") - 1
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
389 if c == 0
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
390 " uhm, give up
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
391 let ind = 0
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
392 else
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
393 " we skipped a bracket set, keep searching for an opening bracket
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
394 let lim = c
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
395 continue
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
396 endif
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
397 endif
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
398
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
399 " Third scenario: nothing special: keep the indentation
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
400 else
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
401 let ind = indent(lnum)
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
402 endif
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
403
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
404 " Does the current line start with a closing bracket? Then depending on
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
405 " the situation we align it with the opening one, or we let the rest of
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
406 " the code figure it out (the case in which we're closing a function
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
407 " argument list is special-cased)
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
408 if JuliaMatch(v:lnum, getline(v:lnum), '[])}]', indent(v:lnum)) == indent(v:lnum) && ind > 0
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
409 if !align_brackets && !align_funcargs
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
410 call JumpToMatch(v:lnum, indent(v:lnum))
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
411 return indent(line("."))
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
412 elseif (align_brackets && getline(v:lnum)[indent(v:lnum)] != ')') || align_funcargs
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
413 return ind - 1
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
414 else " must be a ')' and align_brackets==1 and align_funcargs==0
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
415 call JumpToMatch(v:lnum, indent(v:lnum))
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
416 if IsFunctionArgPar(line("."), col("."))
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
417 let ind = -1
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
418 else
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
419 return ind - 1
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
420 endif
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
421 endif
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
422 endif
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
423
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
424 break
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
425 endwhile
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
426
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
427 if ind == -1
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
428 " We are not in a multiline bracketed expression. Thus we look for a
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
429 " previous line to use as a reference
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
430 let [lnum,ind] = LastBlockIndent(lnum)
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
431 let c = len(getline(lnum)) + 1
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
432 if IsInBrackets(lnum, c)
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
433 let [first_open_bracket, last_open_bracket, last_closed_bracket, infuncargs] = GetJuliaNestingBrackets(lnum, c)
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
434 let lim = first_open_bracket
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
435 endif
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
436 end
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
437
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
438 " Analyse the reference line
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
439 let [num_open_blocks, num_closed_blocks] = GetJuliaNestingStruct(lnum, st, lim)
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
440 " Increase indentation for each newly opened block in the reference line
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
441 let ind += shiftwidth() * num_open_blocks
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
442
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
443 " Analyse the current line
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
444 let [num_open_blocks, num_closed_blocks] = GetJuliaNestingStruct(v:lnum)
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
445 " Decrease indentation for each closed block in the current line
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
446 let ind -= shiftwidth() * num_closed_blocks
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
447
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
448 " Additional special case: multiline import/using/export statements
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
449
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
450 let prevline = getline(lnum)
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
451 " Are we in a multiline import/using/export statement, right below the
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
452 " opening line?
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
453 if IsInContinuationImportLine(v:lnum) && !IsInContinuationImportLine(lnum)
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
454 if get(g:, 'julia_indent_align_import', 1)
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
455 " if the opening line has a colon followed by non-comments, use it as
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
456 " reference point
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
457 let cind = JuliaMatch(lnum, prevline, ':', indent(lnum), lim)
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
458 if cind >= 0
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
459 let nonwhiteind = JuliaMatch(lnum, prevline, '\S', cind+1, -1, 'basic')
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
460 if nonwhiteind >= 0
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
461 " return match(prevline, '\S', cind+1) " a bit overkill...
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
462 return cind + 2
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
463 endif
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
464 else
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
465 " if the opening line is not a naked import/using/export statement, use
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
466 " it as reference
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
467 let iind = JuliaMatch(lnum, prevline, '\<import\|using\|export\>', indent(lnum), lim)
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
468 if iind >= 0
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
469 " assuming whitespace after using... so no `using(XYZ)` please!
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
470 let nonwhiteind = JuliaMatch(lnum, prevline, '\S', iind+6, -1, 'basic')
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
471 if nonwhiteind >= 0
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
472 return match(prevline, '\S', iind+6)
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
473 endif
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
474 endif
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
475 endif
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
476 endif
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
477 let ind += shiftwidth()
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
478
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
479 " Or did we just close a multiline import/using/export statement?
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
480 elseif !IsInContinuationImportLine(v:lnum) && IsInContinuationImportLine(lnum)
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
481 " find the starting line of the statement
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
482 let ilnum = 0
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
483 for iln in range(lnum-1, 1, -1)
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
484 if !IsInContinuationImportLine(iln)
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
485 let ilnum = iln
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
486 break
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
487 endif
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
488 endfor
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
489 if ilnum == 0
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
490 " something went horribly wrong, give up
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
491 let ind = indent(lnum)
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
492 endif
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
493 let ind = indent(ilnum)
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
494 endif
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
495
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
496 return ind
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
497 endfunction