summaryrefslogtreecommitdiffstats
path: root/runtime/indent
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2007-05-05 17:54:07 +0000
committerBram Moolenaar <Bram@vim.org>2007-05-05 17:54:07 +0000
commit9964e468c0209f6b8286e0b08109817c845a3079 (patch)
tree3c53288cff0d4c2e32169d8eb4cd53cc343ad0bc /runtime/indent
parentd5ab34bd5ecc748d5502f149c476968e5ec2b7c9 (diff)
updated for version 7.1a
Diffstat (limited to 'runtime/indent')
-rw-r--r--runtime/indent/ada.vim78
-rw-r--r--runtime/indent/eruby.vim51
-rw-r--r--runtime/indent/html.vim13
-rw-r--r--runtime/indent/htmldjango.vim12
-rw-r--r--runtime/indent/jsp.vim17
-rw-r--r--runtime/indent/ocaml.vim2
-rw-r--r--runtime/indent/python.vim4
-rw-r--r--runtime/indent/ruby.vim14
-rw-r--r--runtime/indent/vhdl.vim111
9 files changed, 209 insertions, 93 deletions
diff --git a/runtime/indent/ada.vim b/runtime/indent/ada.vim
index 8cf915dc43..f2fc1ab4b0 100644
--- a/runtime/indent/ada.vim
+++ b/runtime/indent/ada.vim
@@ -1,19 +1,32 @@
-" Vim indent file
-" Language: Ada
-" Maintainer: Neil Bird <neil@fnxweb.com>
-" Last Change: 2006 Apr 30
-" Version: $Id$
-" Look for the latest version at http://vim.sourceforge.net/
-"
+"------------------------------------------------------------------------------
+" Description: Vim Ada indent file
+" Language: Ada (2005)
+" $Id$
+" Copyright: Copyright (C) 2006 Martin Krischik
+" Maintainer: Martin Krischik
+" Neil Bird <neil@fnxweb.com>
+" $Author$
+" $Date$
+" Version: 4.2
+" $Revision$
+" $HeadURL: https://svn.sourceforge.net/svnroot/gnuada/trunk/tools/vim/indent/ada.vim $
+" History: 24.05.2006 MK Unified Headers
+" 16.07.2006 MK Ada-Mode as vim-ball
+" 15.10.2006 MK Bram's suggestion for runtime integration
+" 05.11.2006 MK Bram suggested to save on spaces
+" Help Page: ft-vim-indent
+"------------------------------------------------------------------------------
" ToDo:
" Verify handling of multi-line exprs. and recovery upon the final ';'.
" Correctly find comments given '"' and "" ==> " syntax.
" Combine the two large block-indent functions into one?
+"------------------------------------------------------------------------------
" Only load this indent file when no other was loaded.
-if exists("b:did_indent")
+if exists("b:did_indent") || version < 700
finish
endif
+
let b:did_indent = 1
setlocal indentexpr=GetAdaIndent()
@@ -25,10 +38,14 @@ if exists("*GetAdaIndent")
finish
endif
-let s:AdaBlockStart = '^\s*\(if\>\|while\>\|else\>\|elsif\>\|loop\>\|for\>.*\<\(loop\|use\)\>\|declare\>\|begin\>\|type\>.*\<is\>[^;]*$\|\(type\>.*\)\=\<record\>\|procedure\>\|function\>\|accept\>\|do\>\|task\>\|package\>\|then\>\|when\>\|is\>\)'
-let s:AdaComment = "\\v^(\"[^\"]*\"|'.'|[^\"']){-}\\zs\\s*--.*"
-
+if exists("g:ada_with_gnat_project_files")
+ let s:AdaBlockStart = '^\s*\(if\>\|while\>\|else\>\|elsif\>\|loop\>\|for\>.*\<\(loop\|use\)\>\|declare\>\|begin\>\|type\>.*\<is\>[^;]*$\|\(type\>.*\)\=\<record\>\|procedure\>\|function\>\|accept\>\|do\>\|task\>\|package\>\|project\>\|then\>\|when\>\|is\>\)'
+else
+ let s:AdaBlockStart = '^\s*\(if\>\|while\>\|else\>\|elsif\>\|loop\>\|for\>.*\<\(loop\|use\)\>\|declare\>\|begin\>\|type\>.*\<is\>[^;]*$\|\(type\>.*\)\=\<record\>\|procedure\>\|function\>\|accept\>\|do\>\|task\>\|package\>\|then\>\|when\>\|is\>\)'
+endif
+" Section: s:MainBlockIndent {{{1
+"
" Try to find indent of the block we're in
" prev_indent = the previous line's indent
" prev_lnum = previous line (to start looking on)
@@ -39,9 +56,9 @@ let s:AdaComment = "\\v^(\"[^\"]*\"|'.'|[^\"']){-}\\zs\\s*--.*"
" This shouldn't work as well as it appears to with lines that are currently
" nowhere near the correct indent (e.g., start of line)!
" Seems to work OK as it 'starts' with the indent of the /previous/ line.
-function s:MainBlockIndent( prev_indent, prev_lnum, blockstart, stop_at )
+function s:MainBlockIndent (prev_indent, prev_lnum, blockstart, stop_at)
let lnum = a:prev_lnum
- let line = substitute( getline(lnum), s:AdaComment, '', '' )
+ let line = substitute( getline(lnum), ada#Comment, '', '' )
while lnum > 1
if a:stop_at != '' && line =~ '^\s*' . a:stop_at && indent(lnum) < a:prev_indent
return a:prev_indent
@@ -55,7 +72,7 @@ function s:MainBlockIndent( prev_indent, prev_lnum, blockstart, stop_at )
let lnum = prevnonblank(lnum - 1)
" Get previous non-blank/non-comment-only line
while 1
- let line = substitute( getline(lnum), s:AdaComment, '', '' )
+ let line = substitute( getline(lnum), ada#Comment, '', '' )
if line !~ '^\s*$' && line !~ '^\s*#'
break
endif
@@ -67,8 +84,10 @@ function s:MainBlockIndent( prev_indent, prev_lnum, blockstart, stop_at )
endwhile
" Fallback - just move back one
return a:prev_indent - &sw
-endfunction
+endfunction MainBlockIndent
+" Section: s:EndBlockIndent {{{1
+"
" Try to find indent of the block we're in (and about to complete),
" including handling of nested blocks. Works on the 'end' of a block.
" prev_indent = the previous line's indent
@@ -97,7 +116,7 @@ function s:EndBlockIndent( prev_indent, prev_lnum, blockstart, blockend )
" Get previous non-blank/non-comment-only line
while 1
let line = getline(lnum)
- let line = substitute( line, s:AdaComment, '', '' )
+ let line = substitute( line, ada#Comment, '', '' )
if line !~ '^\s*$'
break
endif
@@ -109,8 +128,10 @@ function s:EndBlockIndent( prev_indent, prev_lnum, blockstart, blockend )
endwhile
" Fallback - just move back one
return a:prev_indent - &sw
-endfunction
+endfunction EndBlockIndent
+" Section: s:StatementIndent {{{1
+"
" Return indent of previous statement-start
" (after we've indented due to multi-line statements).
" This time, we start searching on the line *before* the one given (which is
@@ -122,7 +143,7 @@ function s:StatementIndent( current_indent, prev_lnum )
let lnum = prevnonblank(lnum - 1)
" Get previous non-blank/non-comment-only line
while 1
- let line = substitute( getline(lnum), s:AdaComment, '', '' )
+ let line = substitute( getline(lnum), ada#Comment, '', '' )
if line !~ '^\s*$' && line !~ '^\s*#'
break
endif
@@ -145,10 +166,13 @@ function s:StatementIndent( current_indent, prev_lnum )
endwhile
" Fallback - just use current one
return a:current_indent
-endfunction
+endfunction StatementIndent
+" Section: GetAdaIndent {{{1
+"
" Find correct indent of a new line based upon what went before
+"
function GetAdaIndent()
" Find a non-blank line above the current line.
let lnum = prevnonblank(v:lnum - 1)
@@ -157,7 +181,7 @@ function GetAdaIndent()
" Get previous non-blank/non-comment-only/non-cpp line
while 1
- let line = substitute( getline(lnum), s:AdaComment, '', '' )
+ let line = substitute( getline(lnum), g:ada#Comment, '', '' )
if line !~ '^\s*$' && line !~ '^\s*#'
break
endif
@@ -198,7 +222,7 @@ function GetAdaIndent()
exe lnum
exe 'normal! $F)%'
if getline('.') =~ '^\s*('
- " Dire layout - use previous indent (could check for AdaComment here)
+ " Dire layout - use previous indent (could check for ada#Comment here)
let ind = indent( prevnonblank( line('.')-1 ) )
else
let ind = indent('.')
@@ -263,6 +287,14 @@ function GetAdaIndent()
endif
return ind
-endfunction
+endfunction GetAdaIndent
-" vim: set sw=3 sts=3 :
+finish " 1}}}
+
+"------------------------------------------------------------------------------
+" Copyright (C) 2006 Martin Krischik
+"
+" Vim is Charityware - see ":help license" or uganda.txt for licence details.
+"------------------------------------------------------------------------------
+" vim: textwidth=78 wrap tabstop=8 shiftwidth=3 softtabstop=3 noexpandtab
+" vim: foldmethod=marker
diff --git a/runtime/indent/eruby.vim b/runtime/indent/eruby.vim
index ab950b6599..d621bfa08b 100644
--- a/runtime/indent/eruby.vim
+++ b/runtime/indent/eruby.vim
@@ -1,16 +1,59 @@
" Vim indent file
-" Language: Ruby
-" Maintainer: Doug Kearns <dougkearns@gmail.com>
+" Language: eRuby
+" Maintainer: Tim Pope <vimNOSPAM@tpope.info>
" Info: $Id$
" URL: http://vim-ruby.rubyforge.org
" Anon CVS: See above site
" Release Coordinator: Doug Kearns <dougkearns@gmail.com>
-" Only load this indent file when no other was loaded.
if exists("b:did_indent")
finish
endif
+runtime! indent/ruby.vim
+unlet! b:did_indent
+
runtime! indent/html.vim
+unlet! b:did_indent
+
+let b:did_indent = 1
+
+setlocal indentexpr=GetErubyIndent(v:lnum)
+setlocal indentkeys=o,O,*<Return>,<>>,{,},0),0],o,O,!^F,=end,=else,=elsif,=rescue,=ensure,=when
+
+" Only define the function once.
+if exists("*GetErubyIndent")
+ finish
+endif
+
+function! GetErubyIndent(lnum)
+ let vcol = col('.')
+ call cursor(a:lnum,1)
+ let inruby = searchpair('<%','','%>')
+ call cursor(a:lnum,vcol)
+ if inruby && getline(a:lnum) !~ '^<%'
+ let ind = GetRubyIndent()
+ else
+ let ind = HtmlIndentGet(a:lnum)
+ endif
+ let lnum = prevnonblank(a:lnum-1)
+ let line = getline(lnum)
+ let cline = getline(a:lnum)
+ if cline =~# '<%\s*\%(end\|else\|\%(ensure\|rescue\|elsif\|when\).\{-\}\)\s*\%(-\=%>\|$\)'
+ let ind = ind - &sw
+ endif
+ if line =~# '\<do\%(\s*|[^|]*|\)\=\s*-\=%>'
+ let ind = ind + &sw
+ elseif line =~# '<%\s*\%(module\|class\|def\|if\|for\|while\|until\|else\|elsif\|case\|when\|unless\|begin\|ensure\|rescue\)\>.*%>'
+ let ind = ind + &sw
+ endif
+ if line =~# '^\s*<%[=#]\=\s*$' && cline !~# '^\s*end\>'
+ let ind = ind + &sw
+ endif
+ if cline =~# '^\s*-\=%>\s*$'
+ let ind = ind - &sw
+ endif
+ return ind
+endfunction
-" vim: nowrap sw=2 sts=2 ts=8 ff=unix:
+" vim:set sw=2 sts=2 ts=8 noet ff=unix:
diff --git a/runtime/indent/html.vim b/runtime/indent/html.vim
index be34409552..6f016ad16c 100644
--- a/runtime/indent/html.vim
+++ b/runtime/indent/html.vim
@@ -1,6 +1,6 @@
" Description: html indenter
" Author: Johannes Zellner <johannes@zellner.org>
-" Last Change: Tue, 27 Apr 2004 10:28:39 CEST
+" Last Change: Mo, 05 Jun 2006 22:32:41 CEST
" Restoring 'cpo' and 'ic' added by Bram 2006 May 5
" Globals: g:html_indent_tags -- indenting tags
" g:html_indent_strict -- inhibit 'O O' elements
@@ -193,8 +193,17 @@ fun! HtmlIndentGet(lnum)
" [-- special handling for <javascript>: use cindent --]
let js = '<script.*type\s*=\s*.*java'
+
+ """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+ " by Tye Zdrojewski <zdro@yahoo.com>, 05 Jun 2006
+ " ZDR: This needs to be an AND (we are 'after the start of the pair' AND
+ " we are 'before the end of the pair'). Otherwise, indentation
+ " before the start of the script block will be affected; the end of
+ " the pair will still match if we are before the beginning of the
+ " pair.
+ "
if 0 < searchpair(js, '', '</script>', 'nWb')
- \ || 0 < searchpair(js, '', '</script>', 'nW')
+ \ && 0 < searchpair(js, '', '</script>', 'nW')
" we're inside javascript
if getline(lnum) !~ js && getline(a:lnum) != '</script>'
if restore_ic == 0
diff --git a/runtime/indent/htmldjango.vim b/runtime/indent/htmldjango.vim
new file mode 100644
index 0000000000..8da9fe3a54
--- /dev/null
+++ b/runtime/indent/htmldjango.vim
@@ -0,0 +1,12 @@
+" Vim indent file
+" Language: Django HTML template
+" Maintainer: Dave Hodder <dmh@dmh.org.uk>
+" Last Change: 2007 Jan 25
+
+" Only load this indent file when no other was loaded.
+if exists("b:did_indent")
+ finish
+endif
+
+" Use HTML formatting rules.
+runtime! indent/html.vim
diff --git a/runtime/indent/jsp.vim b/runtime/indent/jsp.vim
new file mode 100644
index 0000000000..6f7069e94a
--- /dev/null
+++ b/runtime/indent/jsp.vim
@@ -0,0 +1,17 @@
+" Vim filetype indent file
+" Language: JSP files
+" Maintainer: David Fishburn <fishburn@ianywhere.com>
+" Version: 1.0
+" Last Change: Wed Nov 08 2006 11:08:05 AM
+
+" Only load this indent file when no other was loaded.
+if exists("b:did_indent")
+ finish
+endif
+
+" If there has been no specific JSP indent script created,
+" use the default html indent script which will handle
+" html, javascript and most of the JSP constructs.
+runtime! indent/html.vim
+
+
diff --git a/runtime/indent/ocaml.vim b/runtime/indent/ocaml.vim
index 1893d84a8f..5c267af8b1 100644
--- a/runtime/indent/ocaml.vim
+++ b/runtime/indent/ocaml.vim
@@ -4,7 +4,7 @@
" Mike Leary <leary@nwlink.com>
" Markus Mottl <markus.mottl@gmail.com>
" URL: http://www.ocaml.info/vim/indent/ocaml.vim
-" Last Change: 2006 Apr 30
+" Last Change: 2005 Jun 25 - Fixed multiple bugs due to 'else\nreturn ind' working
" 2005 May 09 - Added an option to not indent OCaml-indents specially (MM)
" 2005 Apr 11 - Fixed an indentation bug concerning "let" (MM)
diff --git a/runtime/indent/python.vim b/runtime/indent/python.vim
index 3e14afc99f..0c04e81105 100644
--- a/runtime/indent/python.vim
+++ b/runtime/indent/python.vim
@@ -2,7 +2,7 @@
" Language: Python
" Maintainer: Bram Moolenaar <Bram@vim.org>
" Original Author: David Bustos <bustos@caltech.edu>
-" Last Change: 2006 Apr 30
+" Last Change: 2006 Jun 18
" Only load this indent file when no other was loaded.
if exists("b:did_indent")
@@ -136,7 +136,7 @@ function GetPythonIndent(lnum)
endif
" If the previous line was a stop-execution statement...
- if getline(plnum) =~ '^\s*\(break\|continue\|raise\|return\)\>'
+ if getline(plnum) =~ '^\s*\(break\|continue\|raise\|return\|pass\)\>'
" See if the user has already dedented
if indent(a:lnum) > indent(plnum) - &sw
" If not, recommend one dedent
diff --git a/runtime/indent/ruby.vim b/runtime/indent/ruby.vim
index 3a2837e046..824635bc5d 100644
--- a/runtime/indent/ruby.vim
+++ b/runtime/indent/ruby.vim
@@ -217,7 +217,11 @@ function GetRubyIndent()
call cursor(v:lnum, col)
let bs = strpart('(){}[]', stridx(')}]', line[col - 1]) * 2, 2)
if searchpair(escape(bs[0], '\['), '', bs[1], 'bW', s:skip_expr) > 0
- let ind = line[col-1]==')' ? virtcol('.')-1 : indent(s:GetMSL(line('.')))
+ if line[col-1]==')' && col('.') != col('$') - 1
+ let ind = virtcol('.')-1
+ else
+ let ind = indent(s:GetMSL(line('.')))
+ endif
endif
return ind
endif
@@ -274,7 +278,11 @@ function GetRubyIndent()
if line =~ '[[({]'
let counts = s:LineHasOpeningBrackets(lnum)
if counts[0] == '1' && searchpair('(', '', ')', 'bW', s:skip_expr) > 0
- return virtcol('.')
+ if col('.') + 1 == col('$')
+ return ind + &sw
+ else
+ return virtcol('.')
+ endif
elseif counts[1] == '1' || counts[2] == '1'
return ind + &sw
else
@@ -361,3 +369,5 @@ endfunction
let &cpo = s:cpo_save
unlet s:cpo_save
+
+" vim:set sw=2 sts=2 ts=8 noet ff=unix:
diff --git a/runtime/indent/vhdl.vim b/runtime/indent/vhdl.vim
index c6f01988da..d288be4ceb 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.36
-" Last Change: 2006 Apr 12
+" Version: 1.50
+" Last Change: 2007 Jan 29
" URL: http://www.vim.org/scripts/script.php?script_id=1450
" only load this indent file when no other was loaded
@@ -13,9 +13,11 @@ let b:did_indent = 1
" setup indent options for local VHDL buffer
setlocal indentexpr=GetVHDLindent()
-setlocal indentkeys=!^F,o,O,e,0(,0)
+setlocal indentkeys=!^F,o,O,0(,0)
+setlocal indentkeys+==~begin,=~end\ ,=~end\ ,=~is,=~select,=~when
setlocal indentkeys+==~if,=~then,=~elsif,=~else
-setlocal indentkeys+==~begin,=~is,=~select
+setlocal indentkeys+==~case,=~loop,=~for,=~generate,=~record,=~units,=~process,=~block,=~function,=~component,=~procedure
+setlocal indentkeys+==~architecture,=~configuration,=~entity,=~package
" constants
" not a comment
@@ -25,6 +27,16 @@ let s:ES = '\s*\%(--.*\)\=$'
" no "end" keyword in front
let s:NE = '\%(\<end\s\+\)\@<!'
+" option to disable alignment of generic/port mappings
+if !exists("g:vhdl_align_genportmap")
+ let g:vhdl_align_genportmap = 1
+endif
+
+" option to disable alignment of right-hand side assignment "<=" statements
+if !exists("g:vhdl_align_rhsassign")
+ let g:vhdl_align_rhsassign = 1
+endif
+
" only define indent function once
if exists("*GetVHDLindent")
finish
@@ -100,7 +112,11 @@ function GetVHDLindent()
if m != -1
return m
else
- return stridx(prevs, '(') + &sw
+ if g:vhdl_align_genportmap
+ return stridx(prevs, '(') + &sw
+ else
+ return ind2 + &sw
+ endif
endif
endif
@@ -108,7 +124,11 @@ function GetVHDLindent()
" keywords: variable + "<=" without ";" ending
" where: start of previous line
if prevs =~? '^\s*\S\+\s*<=[^;]*'.s:ES
- return matchend(prevs, '<=\s*\ze.')
+ if g:vhdl_align_rhsassign
+ return matchend(prevs, '<=\s*\ze.')
+ else
+ return ind2 + &sw
+ endif
endif
" indent: backtrace previous non-comment lines for next smaller or equal size indent
@@ -190,7 +210,7 @@ function GetVHDLindent()
" 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
+ if (curs !~? s2.'.*'.s:NC.'\<begin\>.*'.s:ES && prevs =~? s2) || m == 1
let ind = ind + &sw
endif
return ind
@@ -240,61 +260,55 @@ function GetVHDLindent()
" where: start of current line
" find previous opening statement of
" keywords: "for", "if"
- if curs =~? '^\s*\<generate\>' && prevs =~? s:NC.s:NE.'\%(\%(\<wait\s\+\)\@<!\<for\>\|\<if\>\)'
+ if curs =~? '^\s*\<generate\>' && prevs =~? s:NC.s:NE.'\%(\%(\<wait\s\+\)\@<!\<for\|\<if\)\>'
return ind2
endif
" indent: +sw
- " keywords: "begin", "block", "loop", "process", "record", "units"
- " removed: "case", "elsif", "if", "while"
+ " keywords: "block", "process"
+ " removed: "begin", "case", "elsif", "if", "loop", "record", "units", "while"
" where: anywhere in previous line
- if prevs =~? s:NC.'\%(\<begin\>\|'.s:NE.'\<\%(block\|loop\|process\|record\|units\)\>\)'
+ if prevs =~? s:NC.s:NE.'\<\%(block\|process\)\>'
return ind + &sw
endif
" indent: +sw
- " keywords: "architecture", "component", "configuration", "entity", "for", "package"
- " removed: "when", "with"
+ " keywords: "architecture", "configuration", "entity", "package"
+ " removed: "component", "for", "when", "with"
" where: start of previous line
- if prevs =~? '^\s*\%(architecture\|component\|configuration\|entity\|for\|package\)\>'
+ if prevs =~? '^\s*\%(architecture\|configuration\|entity\|package\)\>'
return ind + &sw
endif
" indent: +sw
- " keyword: "generate", "is", "select", "=>"
+ " keyword: "select"
+ " removed: "generate", "is", "=>"
" where: end of previous line
- if prevs =~? s:NC.'\%(\%('.s:NE.'\<generate\|\<is\|\<select\)\|=>\)'.s:ES
+ if prevs =~? s:NC.'\<select'.s:ES
return ind + &sw
endif
" indent: +sw
- " keyword: "else"
+ " keyword: "begin", "loop", "record", "units"
+ " where: anywhere in previous line
+ " keyword: "component", "else", "for"
" where: start of previous line
- " keyword: "then"
+ " keyword: "generate", "is", "then", "=>"
" where: end of previous line
" _note_: indent allowed to leave this filter
- if prevs =~? '^\s*else\>' || prevs =~? s:NC.'\<then'.s:ES
+ 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
let ind = ind + &sw
endif
" ****************************************************************************************
" indent: -sw
- " keywords: "when", provided previous line does not begin with "when"
+ " keywords: "when", provided previous line does not begin with "when", does not end with "is"
" where: start of current line
let s4 = '^\s*when\>'
if curs =~? s4
- if prevs !~? s4
- return ind - &sw
- else
- return ind2
- endif
- endif
-
- " indent: -sw
- " keywords: "else", "elsif", provided previous line does not contain "then"
- " where: start of current line
- if curs =~? '^\s*\%(else\|elsif\)\>'
- if prevs !~? s:NC.'\<then\>'
+ if prevs =~? s:NC.'\<is'.s:ES
+ return ind
+ elseif prevs !~? s4
return ind - &sw
else
return ind2
@@ -302,31 +316,9 @@ function GetVHDLindent()
endif
" indent: -sw
- " keywords: "end" + "if", provided previous line does not begin with "else", not contain "then"
+ " keywords: "else", "elsif", "end" + "block", "for", "function", "generate", "if", "loop", "procedure", "process", "record", "units"
" where: start of current line
- if curs =~? '^\s*end\s\+if\>'
- if prevs !~? '^\s*else\>' && prevs !~? s:NC.'\<then\>'
- return ind - &sw
- else
- return ind2
- endif
- endif
-
- " indent: -sw
- " keywords: "end" + "function", "procedure", provided previous line does not contain "begin"
- " where: start of current line
- if curs =~? '^\s*end\s\+\%(function\|procedure\)\>'
- if prevs !~? s:NC.'\<begin\>'
- return ind - &sw
- else
- return ind2
- endif
- endif
-
- " indent: -sw
- " keywords: "end" + "block", "for", "generate", "loop", "process", "record", "units"
- " where: start of current line
- if curs =~? '^\s*end\s\+\%(block\|for\|generate\|loop\|process\|record\|units\)\>'
+ if curs =~? '^\s*\%(else\|elsif\|end\s\+\%(block\|for\|function\|generate\|if\|loop\|procedure\|process\|record\|units\)\)\>'
return ind - &sw
endif
@@ -365,9 +357,9 @@ function GetVHDLindent()
endif
"indent: follow
"keyword: "component"
- "where: anywhere in previous non-comment line
+ "where: start of previous non-comment line
elseif m == 2
- if ps =~? s:NC.s:NE.'\<component\>'
+ if ps =~? '^\s*component\>'
return indent(pn)
endif
endif
@@ -395,7 +387,8 @@ function GetVHDLindent()
" indent: -sw
" keywords: "end" + identifier
" where: start of current line
- if curs =~? '^\s*end\s\+\w\+\>'
+ "if curs =~? '^\s*end\s\+\w\+\>'
+ if curs =~? '^\s*end\s'
return ind - &sw
endif