annotate runtime/indent/mp.vim @ 8105:d6870d311f01

Added tag v7.4.1346 for changeset 1a03abdc4234281d004cded7d74f67d7aa82e9dc
author Christian Brabandt <cb@256bit.org>
date Thu, 18 Feb 2016 20:30:04 +0100
parents dd6c2497c997
children 876fbdd84e52
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1 " MetaPost indent file
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2 " Language: MetaPost
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3 " Maintainer: Eugene Minkovskii <emin@mccme.ru>
3526
dd6c2497c997 Fix more 'cpo' issues in runtime files.
Bram Moolenaar <bram@vim.org>
parents: 7
diff changeset
4 " Last Change: 2012 May 18
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5 " Version: 0.1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6 " ==========================================================================
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8 " Identation Rules: {{{1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9 " First of all, MetaPost language don't expect any identation rules.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10 " This screept need for you only if you (not MetaPost) need to do
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
11 " exactly code. If you don't need to use indentation, see
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
12 " :help filetype-indent-off
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
13 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
14 " Note: Every rules of identation in MetaPost or TeX languages (and in some
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
15 " other of course) is very subjective. I can release only my vision of this
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
16 " promlem.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
17 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
18 " ..........................................................................
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
19 " Example of correct (by me) identation {{{2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
20 " shiftwidth=4
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
21 " ==========================================================================
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
22 " for i=0 upto 99:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
23 " z[i] = (0,1u) rotated (i*360/100);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
24 " endfor
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
25 " draw z0 -- z10 -- z20
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
26 " withpen ... % <- 2sw because breaked line
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
27 " withcolor ...; % <- same as previous
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
28 " draw z0 for i=1 upto 99:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
29 " -- z[i] % <- 1sw from left end of 'for' satement
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
30 " endfor withpen ... % <- 0sw from left end of 'for' satement
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
31 " withcolor ...; % <- 2sw because breaked line
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
32 " draw if One: % <- This is internal if (like 'for' above)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
33 " one
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
34 " elsif Other:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
35 " other
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
36 " fi withpen ...;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
37 " if one: % <- This is external if
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
38 " draw one;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
39 " elseif other:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
40 " draw other;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
41 " fi
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
42 " draw z0; draw z1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
43 " }}}
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
44 " }}}
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
45
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
46 " Only load this indent file when no other was loaded.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
47 if exists("b:did_indent")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
48 finish
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
49 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
50 let b:did_indent = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
51
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
52 setlocal indentexpr=GetMetaPostIndent()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
53 setlocal indentkeys+=;,<:>,=if,=for,=def,=end,=else,=fi
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
54
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
55 " Only define the function once.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
56 if exists("*GetMetaPostIndent")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
57 finish
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
58 endif
3526
dd6c2497c997 Fix more 'cpo' issues in runtime files.
Bram Moolenaar <bram@vim.org>
parents: 7
diff changeset
59 let s:keepcpo= &cpo
dd6c2497c997 Fix more 'cpo' issues in runtime files.
Bram Moolenaar <bram@vim.org>
parents: 7
diff changeset
60 set cpo&vim
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
61
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
62 " Auxiliary Definitions: {{{1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
63 function! MetaNextNonblankNoncomment(pos)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
64 " Like nextnonblank() but ignore comment lines
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
65 let tmp = nextnonblank(a:pos)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
66 while tmp && getline(tmp) =~ '^\s*%'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
67 let tmp = nextnonblank(tmp+1)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
68 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
69 return tmp
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
70 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
71
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
72 function! MetaPrevNonblankNoncomment(pos)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
73 " Like prevnonblank() but ignore comment lines
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
74 let tmp = prevnonblank(a:pos)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
75 while tmp && getline(tmp) =~ '^\s*%'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
76 let tmp = prevnonblank(tmp-1)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
77 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
78 return tmp
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
79 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
80
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
81 function! MetaSearchNoncomment(pattern, ...)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
82 " Like search() but ignore commented areas
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
83 if a:0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
84 let flags = a:1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
85 elseif &wrapscan
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
86 let flags = "w"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
87 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
88 let flags = "W"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
89 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
90 let cl = line(".")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
91 let cc = col(".")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
92 let tmp = search(a:pattern, flags)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
93 while tmp && synIDattr(synID(line("."), col("."), 1), "name") =~
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
94 \ 'm[fp]\(Comment\|TeXinsert\|String\)'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
95 let tmp = search(a:pattern, flags)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
96 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
97 if !tmp
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
98 call cursor(cl,cc)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
99 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
100 return tmp
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
101 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
102 " }}}
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
103
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
104 function! GetMetaPostIndent()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
105 " not indent in comment ???
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
106 if synIDattr(synID(line("."), col("."), 1), "name") =~
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
107 \ 'm[fp]\(Comment\|TeXinsert\|String\)'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
108 return -1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
109 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
110 " Some RegExps: {{{1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
111 " end_of_item: all of end by ';'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
112 " + all of end by :endfor, :enddef, :endfig, :endgroup, :fi
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
113 " + all of start by :beginfig(num), :begingroup
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
114 " + all of start by :for, :if, :else, :elseif and end by ':'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
115 " + all of start by :def, :vardef and end by '='
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
116 let end_of_item = '\(' .
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
117 \ ';\|' .
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
118 \ '\<\(end\(for\|def\|fig\|group\)\|fi\)\>\|' .
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
119 \ '\<begin\(group\>\|fig\s*(\s*\d\+\s*)\)\|' .
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
120 \ '\<\(for\|if\|else\(if\)\=\)\>.\+:\|' .
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
121 \ '\<\(var\)\=def\>.\+=' . '\)'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
122 " }}}
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
123 " Save: current position {{{1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
124 let cl = line (".")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
125 let cc = col (".")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
126 let cs = getline(".")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
127 " if it is :beginfig or :endfig use zero indent
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
128 if cs =~ '^\s*\(begin\|end\)fig\>'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
129 return 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
130 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
131 " }}}
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
132 " Initialise: ind variable {{{1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
133 " search previous item not in current line
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
134 let p_semicol_l = MetaSearchNoncomment(end_of_item,"bW")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
135 while p_semicol_l == cl
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
136 let p_semicol_l = MetaSearchNoncomment(end_of_item,"bW")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
137 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
138 " if this is first item in program use zero indent
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
139 if !p_semicol_l
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
140 return 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
141 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
142 " if this is multiline item, remember first indent
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
143 if MetaNextNonblankNoncomment(p_semicol_l+1) < cl
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
144 let ind = indent(MetaNextNonblankNoncomment(p_semicol_l+1))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
145 " else --- search pre-previous item for search first line in previous item
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
146 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
147 " search pre-previous item not in current line
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
148 let pp_semicol_l = MetaSearchNoncomment(end_of_item,"bW")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
149 while pp_semicol_l == p_semicol_l
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
150 let pp_semicol_l = MetaSearchNoncomment(end_of_item,"bW")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
151 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
152 " if we find pre-previous item, remember indent of previous item
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
153 " else --- remember zero
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
154 if pp_semicol_l
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
155 let ind = indent(MetaNextNonblankNoncomment(line(".")+1))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
156 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
157 let ind = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
158 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
159 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
160 " }}}
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
161 " Increase Indent: {{{1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
162 " if it is an internal/external :for or :if statements {{{2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
163 let pnn_s = getline(MetaPrevNonblankNoncomment(cl-1))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
164 if pnn_s =~ '\<\(for\|if\)\>.\+:\s*\($\|%\)'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
165 let ind = match(pnn_s, '\<\(for\|if\)\>.\+:\s*\($\|%\)') + &sw
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
166 " }}}
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
167 " if it is a :def, :vardef, :beginfig, :begingroup, :else, :elseif {{{2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
168 elseif pnn_s =~ '^\s*\(' .
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
169 \ '\(var\)\=def\|' .
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
170 \ 'begin\(group\|fig\s*(\s*\d\+\s*)\)\|' .
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
171 \ 'else\(if\)\=' . '\)\>'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
172 let ind = ind + &sw
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
173 " }}}
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
174 " if it is a broken line {{{2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
175 elseif pnn_s !~ end_of_item.'\s*\($\|%\)'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
176 let ind = ind + (2 * &sw)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
177 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
178 " }}}
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
179 " }}}
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
180 " Decrease Indent: {{{1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
181 " if this is :endfor or :enddef statements {{{2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
182 " this is correct because :def cannot be inside :for
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
183 if cs =~ '\<end\(for\|def\)\=\>'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
184 call MetaSearchNoncomment('\<for\>.\+:\s*\($\|%\)' . '\|' .
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
185 \ '^\s*\(var\)\=def\>',"bW")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
186 if col(".") > 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
187 let ind = col(".") - 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
188 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
189 let ind = indent(".")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
190 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
191 " }}}
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
192 " if this is :fi, :else, :elseif statements {{{2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
193 elseif cs =~ '\<\(else\(if\)\=\|fi\)\>'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
194 call MetaSearchNoncomment('\<if\>.\+:\s*\($\|%\)',"bW")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
195 let ind = col(".") - 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
196 " }}}
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
197 " if this is :endgroup statement {{{2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
198 elseif cs =~ '^\s*endgroup\>'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
199 let ind = ind - &sw
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
200 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
201 " }}}
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
202 " }}}
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
203
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
204 return ind
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
205 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
206 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
207
3526
dd6c2497c997 Fix more 'cpo' issues in runtime files.
Bram Moolenaar <bram@vim.org>
parents: 7
diff changeset
208 let &cpo = s:keepcpo
dd6c2497c997 Fix more 'cpo' issues in runtime files.
Bram Moolenaar <bram@vim.org>
parents: 7
diff changeset
209 unlet s:keepcpo
dd6c2497c997 Fix more 'cpo' issues in runtime files.
Bram Moolenaar <bram@vim.org>
parents: 7
diff changeset
210
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
211 " vim:sw=2:fdm=marker