comparison runtime/indent/vhdl.vim @ 11518:63b0b7b79b25

Update runtime files. commit https://github.com/vim/vim/commit/3ec574f2b549f456f664f689d6da36dc5719aeb9 Author: Bram Moolenaar <Bram@vim.org> Date: Tue Jun 13 18:12:01 2017 +0200 Update runtime files. Includes changing &sw to shiftwidth() for all indent scripts.
author Christian Brabandt <cb@256bit.org>
date Tue, 13 Jun 2017 18:15:04 +0200
parents ecb621205ed1
children 3b26420fc639
comparison
equal deleted inserted replaced
11517:01330ca5f7f8 11518:63b0b7b79b25
1 " VHDL indent ('93 syntax) 1 " VHDL indent ('93 syntax)
2 " Language: VHDL 2 " Language: VHDL
3 " Maintainer: Gerald Lai <laigera+vim?gmail.com> 3 " Maintainer: Gerald Lai <laigera+vim?gmail.com>
4 " Version: 1.60 4 " Version: 1.60
5 " Last Change: 2016 Feb 26 5 " Last Change: 2017 Jun 13
6 " URL: http://www.vim.org/scripts/script.php?script_id=1450 6 " URL: http://www.vim.org/scripts/script.php?script_id=1450
7 7
8 " only load this indent file when no other was loaded 8 " only load this indent file when no other was loaded
9 if exists("b:did_indent") 9 if exists("b:did_indent")
10 finish 10 finish
112 let m = matchend(prevs_noi, '(\s*\ze\w') 112 let m = matchend(prevs_noi, '(\s*\ze\w')
113 if m != -1 113 if m != -1
114 return ind2 + m 114 return ind2 + m
115 else 115 else
116 if g:vhdl_indent_genportmap 116 if g:vhdl_indent_genportmap
117 return ind2 + stridx(prevs_noi, '(') + &sw 117 return ind2 + stridx(prevs_noi, '(') + shiftwidth()
118 else 118 else
119 return ind2 + &sw 119 return ind2 + shiftwidth()
120 endif 120 endif
121 endif 121 endif
122 endif 122 endif
123 123
124 " indent: align conditional/select statement 124 " indent: align conditional/select statement
126 " where: start of previous line 126 " where: start of previous line
127 if prevs =~? '^\s*\S\+\s*<=[^;]*'.s:ES 127 if prevs =~? '^\s*\S\+\s*<=[^;]*'.s:ES
128 if g:vhdl_indent_rhsassign 128 if g:vhdl_indent_rhsassign
129 return ind2 + matchend(prevs_noi, '<=\s*\ze.') 129 return ind2 + matchend(prevs_noi, '<=\s*\ze.')
130 else 130 else
131 return ind2 + &sw 131 return ind2 + shiftwidth()
132 endif 132 endif
133 endif 133 endif
134 134
135 " indent: backtrace previous non-comment lines for next smaller or equal size indent 135 " indent: backtrace previous non-comment lines for next smaller or equal size indent
136 " keywords: "end" + "record", "units" 136 " keywords: "end" + "record", "units"
216 while pn > 0 && (ps =~ '^\s*--' || ps !~? s2) 216 while pn > 0 && (ps =~ '^\s*--' || ps !~? s2)
217 let pn = prevnonblank(pn - 1) 217 let pn = prevnonblank(pn - 1)
218 let ps = getline(pn) 218 let ps = getline(pn)
219 219
220 if (ps =~? s:NC.'\<begin\>') 220 if (ps =~? s:NC.'\<begin\>')
221 return indent(pn) - &sw 221 return indent(pn) - shiftwidth()
222 endif 222 endif
223 endwhile 223 endwhile
224 224
225 if (pn == 0) 225 if (pn == 0)
226 return ind - &sw 226 return ind - shiftwidth()
227 else 227 else
228 return indent(pn) 228 return indent(pn)
229 endif 229 endif
230 endif 230 endif
231 231
235 if curs =~? s:NC.s:NE.'\<\%(record\|units\)\>' 235 if curs =~? s:NC.s:NE.'\<\%(record\|units\)\>'
236 " find previous opening statement of 236 " find previous opening statement of
237 " keyword: "type" 237 " keyword: "type"
238 let s3 = s:NC.s:NE.'\<type\>' 238 let s3 = s:NC.s:NE.'\<type\>'
239 if curs !~? s3.'.*'.s:NC.'\<\%(record\|units\)\>.*'.s:ES && prevs =~? s3 239 if curs !~? s3.'.*'.s:NC.'\<\%(record\|units\)\>.*'.s:ES && prevs =~? s3
240 let ind = ind + &sw 240 let ind = ind + shiftwidth()
241 endif 241 endif
242 return ind 242 return ind
243 endif 243 endif
244 244
245 " **************************************************************************************** 245 " ****************************************************************************************
280 " indent: +sw 280 " indent: +sw
281 " keywords: "block", "process" 281 " keywords: "block", "process"
282 " removed: "begin", "case", "elsif", "if", "loop", "record", "units", "while" 282 " removed: "begin", "case", "elsif", "if", "loop", "record", "units", "while"
283 " where: anywhere in previous line 283 " where: anywhere in previous line
284 if prevs =~? s:NC.s:NE.'\<\%(block\|process\)\>' 284 if prevs =~? s:NC.s:NE.'\<\%(block\|process\)\>'
285 return ind + &sw 285 return ind + shiftwidth()
286 endif 286 endif
287 287
288 " indent: +sw 288 " indent: +sw
289 " keywords: "architecture", "configuration", "entity", "package" 289 " keywords: "architecture", "configuration", "entity", "package"
290 " removed: "component", "for", "when", "with" 290 " removed: "component", "for", "when", "with"
291 " where: start of previous line 291 " where: start of previous line
292 if prevs =~? '^\s*\%(architecture\|configuration\|entity\|package\)\>' 292 if prevs =~? '^\s*\%(architecture\|configuration\|entity\|package\)\>'
293 return ind + &sw 293 return ind + shiftwidth()
294 endif 294 endif
295 295
296 " indent: +sw 296 " indent: +sw
297 " keyword: "select" 297 " keyword: "select"
298 " removed: "generate", "is", "=>" 298 " removed: "generate", "is", "=>"
299 " where: end of previous line 299 " where: end of previous line
300 if prevs =~? s:NC.'\<select'.s:ES 300 if prevs =~? s:NC.'\<select'.s:ES
301 return ind + &sw 301 return ind + shiftwidth()
302 endif 302 endif
303 303
304 " indent: +sw 304 " indent: +sw
305 " keyword: "begin", "loop", "record", "units" 305 " keyword: "begin", "loop", "record", "units"
306 " where: anywhere in previous line 306 " where: anywhere in previous line
308 " where: start of previous line 308 " where: start of previous line
309 " keyword: "generate", "is", "then", "=>" 309 " keyword: "generate", "is", "then", "=>"
310 " where: end of previous line 310 " where: end of previous line
311 " _note_: indent allowed to leave this filter 311 " _note_: indent allowed to leave this filter
312 if prevs =~? s:NC.'\%(\<begin\>\|'.s:NE.'\<\%(loop\|record\|units\)\>\)' || prevs =~? '^\s*\%(component\|else\|for\)\>' || prevs =~? s:NC.'\%('.s:NE.'\<generate\|\<\%(is\|then\)\|=>\)'.s:ES 312 if prevs =~? s:NC.'\%(\<begin\>\|'.s:NE.'\<\%(loop\|record\|units\)\>\)' || prevs =~? '^\s*\%(component\|else\|for\)\>' || prevs =~? s:NC.'\%('.s:NE.'\<generate\|\<\%(is\|then\)\|=>\)'.s:ES
313 let ind = ind + &sw 313 let ind = ind + shiftwidth()
314 endif 314 endif
315 315
316 " **************************************************************************************** 316 " ****************************************************************************************
317 " indent: -sw 317 " indent: -sw
318 " keywords: "when", provided previous line does not begin with "when", does not end with "is" 318 " keywords: "when", provided previous line does not begin with "when", does not end with "is"
320 let s4 = '^\s*when\>' 320 let s4 = '^\s*when\>'
321 if curs =~? s4 321 if curs =~? s4
322 if prevs =~? s:NC.'\<is'.s:ES 322 if prevs =~? s:NC.'\<is'.s:ES
323 return ind 323 return ind
324 elseif prevs !~? s4 324 elseif prevs !~? s4
325 return ind - &sw 325 return ind - shiftwidth()
326 else 326 else
327 return ind2 327 return ind2
328 endif 328 endif
329 endif 329 endif
330 330
334 let s5 = 'block\|for\|function\|generate\|if\|loop\|procedure\|process\|record\|units' 334 let s5 = 'block\|for\|function\|generate\|if\|loop\|procedure\|process\|record\|units'
335 if curs =~? '^\s*\%(else\|elsif\|end\s\+\%('.s5.'\)\)\>' 335 if curs =~? '^\s*\%(else\|elsif\|end\s\+\%('.s5.'\)\)\>'
336 if prevs =~? '^\s*\%(elsif\|'.s5.'\)' 336 if prevs =~? '^\s*\%(elsif\|'.s5.'\)'
337 return ind 337 return ind
338 else 338 else
339 return ind - &sw 339 return ind - shiftwidth()
340 endif 340 endif
341 endif 341 endif
342 342
343 " indent: backtrace previous non-comment lines 343 " indent: backtrace previous non-comment lines
344 " keyword: "end" + "case", "component" 344 " keyword: "end" + "case", "component"
365 "indent: follow 365 "indent: follow
366 "keywords: "case" 366 "keywords: "case"
367 "where: start of previous non-comment line 367 "where: start of previous non-comment line
368 if m == 1 368 if m == 1
369 if ps =~? '^\s*end\s\+case\>' 369 if ps =~? '^\s*end\s\+case\>'
370 return indent(pn) - 2 * &sw 370 return indent(pn) - 2 * shiftwidth()
371 elseif ps =~? '^\s*when\>' 371 elseif ps =~? '^\s*when\>'
372 return indent(pn) - &sw 372 return indent(pn) - shiftwidth()
373 elseif ps =~? '^\s*case\>' 373 elseif ps =~? '^\s*case\>'
374 return indent(pn) 374 return indent(pn)
375 endif 375 endif
376 "indent: follow 376 "indent: follow
377 "keyword: "component" 377 "keyword: "component"
383 endif 383 endif
384 endif 384 endif
385 let pn = prevnonblank(pn - 1) 385 let pn = prevnonblank(pn - 1)
386 let ps = getline(pn) 386 let ps = getline(pn)
387 endwhile 387 endwhile
388 return ind - &sw 388 return ind - shiftwidth()
389 endif 389 endif
390 390
391 " indent: -sw 391 " indent: -sw
392 " keyword: ")" 392 " keyword: ")"
393 " where: start of current line 393 " where: start of current line
394 if curs =~ '^\s*)' 394 if curs =~ '^\s*)'
395 return ind - &sw 395 return ind - shiftwidth()
396 endif 396 endif
397 397
398 " indent: 0 398 " indent: 0
399 " keywords: "end" + "architecture", "configuration", "entity", "package" 399 " keywords: "end" + "architecture", "configuration", "entity", "package"
400 " where: start of current line 400 " where: start of current line
405 " indent: -sw 405 " indent: -sw
406 " keywords: "end" + identifier, ";" 406 " keywords: "end" + identifier, ";"
407 " where: start of current line 407 " where: start of current line
408 "if curs =~? '^\s*end\s\+\w\+\>' 408 "if curs =~? '^\s*end\s\+\w\+\>'
409 if curs =~? '^\s*end\%(\s\|;'.s:ES.'\)' 409 if curs =~? '^\s*end\%(\s\|;'.s:ES.'\)'
410 return ind - &sw 410 return ind - shiftwidth()
411 endif 411 endif
412 412
413 " **************************************************************************************** 413 " ****************************************************************************************
414 " indent: maintain indent of previous opening statement 414 " indent: maintain indent of previous opening statement
415 " keywords: without "procedure", "generic", "map", "port" + ":" but not ":=" + eventually ;$ 415 " keywords: without "procedure", "generic", "map", "port" + ":" but not ":=" + eventually ;$