diff options
author | Bram Moolenaar <Bram@vim.org> | 2011-10-20 22:22:38 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2011-10-20 22:22:38 +0200 |
commit | 1514667a24c00c247d8527e9a2e12dba97ca9d85 (patch) | |
tree | b5f8c262ed1763dd64224736e374ec90de5df4d9 /runtime/indent | |
parent | e3cc6d422367e5d7a0a15c69480313644caefd01 (diff) | |
download | vim-1514667a24c00c247d8527e9a2e12dba97ca9d85.zip |
Updated runtime files.
Diffstat (limited to 'runtime/indent')
-rw-r--r-- | runtime/indent/r.vim | 14 | ||||
-rw-r--r-- | runtime/indent/vhdl.vim | 45 |
2 files changed, 43 insertions, 16 deletions
diff --git a/runtime/indent/r.vim b/runtime/indent/r.vim index 9c78f3045..7d28f2910 100644 --- a/runtime/indent/r.vim +++ b/runtime/indent/r.vim @@ -1,7 +1,7 @@ " Vim indent file " Language: R " Author: Jakson Alves de Aquino <jalvesaq@gmail.com> -" Last Change: Wed Aug 31, 2011 12:24AM +" Last Change: Fri Oct 14, 2011 09:50PM " Only load this indent file when no other was loaded. @@ -455,19 +455,29 @@ function GetRIndent() return ind endif + if g:r_indent_align_args == 0 && bb != 0 + let ind += bb * &sw + return ind + endif + if ind == pind || (ind == (pind + &sw) && pline =~ '{$' && ppost_else == 0) return ind endif - while pind < ind && plnum > 0 && ppb == 0 + let pline = getline(plnum) + let pbb = s:Get_paren_balance(pline, '[', ']') + + while pind < ind && plnum > 0 && ppb == 0 && pbb == 0 let ind = pind let plnum = s:Get_prev_line(plnum) let pline = getline(plnum) let ppb = s:Get_paren_balance(pline, '(', ')') + let pbb = s:Get_paren_balance(pline, '[', ']') while pline =~ '^\s*else' let plnum = s:Get_matching_if(plnum, 1) let pline = getline(plnum) let ppb = s:Get_paren_balance(pline, '(', ')') + let pbb = s:Get_paren_balance(pline, '[', ']') endwhile let pind = indent(plnum) if ind == (pind + &sw) && pline =~ '{$' diff --git a/runtime/indent/vhdl.vim b/runtime/indent/vhdl.vim index 717857fe3..3e847b957 100644 --- a/runtime/indent/vhdl.vim +++ b/runtime/indent/vhdl.vim @@ -1,8 +1,8 @@ " VHDL indent ('93 syntax) " Language: VHDL " Maintainer: Gerald Lai <laigera+vim?gmail.com> -" Version: 1.56 -" Last Change: 2010 Jun 29 +" Version: 1.58 +" Last Change: 2011 Sep 27 " URL: http://www.vim.org/scripts/script.php?script_id=1450 " only load this indent file when no other was loaded @@ -95,7 +95,7 @@ function GetVHDLindent() " **************************************************************************************** " indent: align generic variables & port names - " keywords: "generic", "map", "port" + "(", provided current line is part of mapping + " keywords: "procedure" + name, "generic", "map", "port" + "(", provided current line is part of mapping " where: anywhere in previous 2 lines " find following previous non-comment line let pn = prevnonblank(prevn - 1) @@ -104,7 +104,7 @@ function GetVHDLindent() let pn = prevnonblank(pn - 1) let ps = getline(pn) endwhile - if (curs =~ '^\s*)' || curs =~? '^\s*\%(\<\%(generic\|map\|port\)\>.*\)\@<!\S\+\s*\%(=>\s*\S\+\|:[^=]\@=\s*\%(\%(in\|out\|inout\|buffer\|linkage\)\>\|\w\+\s\+:=\)\)') && (prevs =~? s:NC.'\<\%(generic\|map\|port\)\s*(\%(\s*\w\)\=' || (ps =~? s:NC.'\<\%(generic\|map\|port\)'.s:ES && prevs =~ '^\s*(')) + if (curs =~ '^\s*)' || curs =~? '^\s*\%(\<\%(procedure\|generic\|map\|port\)\>.*\)\@<!\w\+\s*\w*\s*\%(=>\s*\S\+\|:[^=]\@=\s*\%(\%(in\|out\|inout\|buffer\|linkage\)\>\|\w\+\s\+:=\)\)') && (prevs =~? s:NC.'\<\%(procedure\s\+\S\+\|generic\|map\|port\)\s*(\%(\s*\w\)\=' || (ps =~? s:NC.'\<\%(procedure\|generic\|map\|port\)'.s:ES && prevs =~ '^\s*(')) " align closing ")" with opening "(" if curs =~ '^\s*)' return ind2 + stridx(prevs_noi, '(') @@ -160,12 +160,12 @@ function GetVHDLindent() " make sure one of these is true " keywords: variable + "<=" without ";" ending " where: start of previous non-comment line - " keywords: "generic", "map", "port" + " keywords: "procedure", "generic", "map", "port" " where: anywhere in previous non-comment line " keyword: "(" " where: start of previous non-comment line if m < 3 && ps !~? '^\s*\S\+\s*<=[^;]*'.s:ES - if ps =~? s:NC.'\<\%(generic\|map\|port\)\>' || ps =~ '^\s*(' + if ps =~? s:NC.'\<\%(procedure\|generic\|map\|port\)\>' || ps =~ '^\s*(' let ind = t endif break @@ -207,14 +207,26 @@ function GetVHDLindent() " keyword: "begin" " where: anywhere in current line if curs =~? s:NC.'\<begin\>' - let ind = ind - &sw " find previous opening statement of " keywords: "architecture", "block", "entity", "function", "generate", "procedure", "process" let s2 = s:NC.s:NE.'\<\%(architecture\|block\|entity\|function\|generate\|procedure\|process\)\>' - if (curs !~? s2.'.*'.s:NC.'\<begin\>.*'.s:ES && prevs =~? s2) || m == 1 - let ind = ind + &sw + + let pn = prevnonblank(curn - 1) + let ps = getline(pn) + while pn > 0 && (ps =~ '^\s*--' || ps !~? s2) + let pn = prevnonblank(pn - 1) + let ps = getline(pn) + + if (ps =~? s:NC.'\<begin\>') + return indent(pn) - &sw + endif + endwhile + + if (pn == 0) + return ind - &sw + else + return indent(pn) endif - return ind endif " indent: +sw if previous line is previous opening statement @@ -319,8 +331,13 @@ function GetVHDLindent() " indent: -sw " keywords: "else", "elsif", "end" + "block", "for", "function", "generate", "if", "loop", "procedure", "process", "record", "units" " where: start of current line - if curs =~? '^\s*\%(else\|elsif\|end\s\+\%(block\|for\|function\|generate\|if\|loop\|procedure\|process\|record\|units\)\)\>' - return ind - &sw + let s5 = 'block\|for\|function\|generate\|if\|loop\|procedure\|process\|record\|units' + if curs =~? '^\s*\%(else\|elsif\|end\s\+\%('.s5.'\)\)\>' + if prevs =~? '^\s*\%(elsif\|'.s5.'\)' + return ind + else + return ind - &sw + endif endif " indent: backtrace previous non-comment lines @@ -395,9 +412,9 @@ function GetVHDLindent() " **************************************************************************************** " indent: maintain indent of previous opening statement - " keywords: without "generic", "map", "port" + ":" but not ":=" + "in", "out", "inout", "buffer", "linkage", variable & ":=" + " keywords: without "procedure", "generic", "map", "port" + ":" but not ":=" + "in", "out", "inout", "buffer", "linkage", variable & ":=" " where: start of current line - if curs =~? '^\s*\%(\<\%(generic\|map\|port\)\>.*\)\@<!\S\+\s*:[^=]\@=\s*\%(\%(in\|out\|inout\|buffer\|linkage\)\>\|\w\+\s\+:=\)' + if curs =~? '^\s*\%(\<\%(procedure\|generic\|map\|port\)\>.*\)\@<!\w\+\s*\w*\s*:[^=]\@=\s*\%(\%(in\|out\|inout\|buffer\|linkage\)\>\|\w\+\s\+:=\)' return ind2 endif |