changeset 29659:2198955f9e27

Update runtime files Commit: https://github.com/vim/vim/commit/48c3f4e0bff7efd289a7001b68c777b6f89a7057 Author: Bram Moolenaar <Bram@vim.org> Date: Mon Aug 8 15:42:38 2022 +0100 Update runtime files
author Bram Moolenaar <Bram@vim.org>
date Mon, 08 Aug 2022 16:45:05 +0200
parents 006939bc47b1
children e134ff00be57
files .github/CODEOWNERS runtime/autoload/dist/ft.vim runtime/autoload/python.vim runtime/doc/help.txt runtime/doc/options.txt runtime/doc/tags runtime/doc/terminal.txt runtime/doc/todo.txt runtime/doc/usr_41.txt runtime/doc/vim9.txt runtime/ftplugin/abaqus.vim runtime/ftplugin/php.vim runtime/ftplugin/vim.vim runtime/indent/lisp.vim runtime/indent/systemverilog.vim runtime/indent/testdir/python.in runtime/indent/testdir/python.ok runtime/pack/dist/opt/matchit/doc/matchit.txt runtime/syntax/abaqus.vim
diffstat 19 files changed, 511 insertions(+), 210 deletions(-) [+]
line wrap: on
line diff
--- a/.github/CODEOWNERS
+++ b/.github/CODEOWNERS
@@ -98,6 +98,7 @@ runtime/doc/pi_tar.txt			@cecamp
 runtime/doc/pi_vimball.txt		@cecamp
 runtime/doc/pi_zip.txt			@cecamp
 runtime/doc/ps1.txt			@heaths
+runtime/ftplugin/abaqus.vim		@costerwi
 runtime/ftplugin/awk.vim		@dkearns
 runtime/ftplugin/basic.vim		@dkearns
 runtime/ftplugin/bst.vim		@tpope
@@ -267,6 +268,7 @@ runtime/plugin/netrwPlugin.vim		@cecamp
 runtime/plugin/tarPlugin.vim		@cecamp
 runtime/plugin/vimballPlugin.vim	@cecamp
 runtime/plugin/zipPlugin.vim		@cecamp
+runtime/syntax/abaqus.vim		@costerwi
 runtime/syntax/aidl.vim			@dpelle
 runtime/syntax/amiga.vim		@cecamp
 runtime/syntax/arduino.vim		@johshoff
--- a/runtime/autoload/dist/ft.vim
+++ b/runtime/autoload/dist/ft.vim
@@ -348,7 +348,7 @@ export def FTidl()
   setf idl
 enddef
 
-# Distinguish between "default" and Cproto prototype file. */
+# Distinguish between "default", Prolog and Cproto prototype file.
 export def ProtoCheck(default: string)
   # Cproto files have a comment in the first line and a function prototype in
   # the second line, it always ends in ";".  Indent files may also have
@@ -358,7 +358,14 @@ export def ProtoCheck(default: string)
   if getline(2) =~ '.;$'
     setf cpp
   else
-    exe 'setf ' .. default
+    # recognize Prolog by specific text in the first non-empty line
+    # require a blank after the '%' because Perl uses "%list" and "%translate"
+    var l = getline(nextnonblank(1))
+    if l =~ '\<prolog\>' || l =~ '^\s*\(%\+\(\s\|$\)\|/\*\)' || l =~ ':-'
+      setf prolog
+    else
+      exe 'setf ' .. default
+    endif
   endif
 enddef
 
--- a/runtime/autoload/python.vim
+++ b/runtime/autoload/python.vim
@@ -3,13 +3,28 @@
 let s:keepcpo= &cpo
 set cpo&vim
 
+" searchpair() can be slow, limit the time to 150 msec or what is put in
+" g:pyindent_searchpair_timeout
+let s:searchpair_timeout = get(g:, 'pyindent_searchpair_timeout', 150)
+
+" Identing inside parentheses can be very slow, regardless of the searchpair()
+" timeout, so let the user disable this feature if he doesn't need it
+let s:disable_parentheses_indenting = get(g:, 'pyindent_disable_parentheses_indenting', v:false)
+
+let s:maxoff = 50       " maximum number of lines to look backwards for ()
+
+function s:SearchBracket(fromlnum, flags)
+  return searchpairpos('[[({]', '', '[])}]', a:flags,
+          \ {-> synID('.', col('.'), v:true)->synIDattr('name')
+          \ =~ '\%(Comment\|Todo\|String\)$'},
+          \ [0, a:fromlnum - s:maxoff]->max(), s:searchpair_timeout)
+endfunction
+
 " See if the specified line is already user-dedented from the expected value.
 function s:Dedented(lnum, expected)
   return indent(a:lnum) <= a:expected - shiftwidth()
 endfunction
 
-let s:maxoff = 50       " maximum number of lines to look backwards for ()
-
 " Some other filetypes which embed Python have slightly different indent
 " rules (e.g. bitbake). Those filetypes can pass an extra funcref to this
 " function which is evaluated below.
@@ -39,30 +54,30 @@ function python#GetIndent(lnum, ...)
     return 0
   endif
 
-  call cursor(plnum, 1)
-
-  " Identing inside parentheses can be very slow, regardless of the searchpair()
-  " timeout, so let the user disable this feature if he doesn't need it
-  let disable_parentheses_indenting = get(g:, "pyindent_disable_parentheses_indenting", 0)
-
-  if disable_parentheses_indenting == 1
+  if s:disable_parentheses_indenting == 1
     let plindent = indent(plnum)
     let plnumstart = plnum
   else
-    " searchpair() can be slow sometimes, limit the time to 150 msec or what is
-    " put in g:pyindent_searchpair_timeout
-    let searchpair_stopline = 0
-    let searchpair_timeout = get(g:, 'pyindent_searchpair_timeout', 150)
+    " Indent inside parens.
+    " Align with the open paren unless it is at the end of the line.
+    " E.g.
+    "     open_paren_not_at_EOL(100,
+    "                           (200,
+    "                            300),
+    "                           400)
+    "     open_paren_at_EOL(
+    "         100, 200, 300, 400)
+    call cursor(a:lnum, 1)
+    let [parlnum, parcol] = s:SearchBracket(a:lnum, 'nbW')
+    if parlnum > 0 && parcol != col([parlnum, '$']) - 1
+      return parcol
+    endif
+
+    call cursor(plnum, 1)
 
     " If the previous line is inside parenthesis, use the indent of the starting
     " line.
-    " Trick: use the non-existing "dummy" variable to break out of the loop when
-    " going too far back.
-    let parlnum = searchpair('(\|{\|\[', '', ')\|}\|\]', 'nbW',
-            \ "line('.') < " . (plnum - s:maxoff) . " ? dummy :"
-            \ . " synIDattr(synID(line('.'), col('.'), 1), 'name')"
-            \ . " =~ '\\(Comment\\|Todo\\|String\\)$'",
-            \ searchpair_stopline, searchpair_timeout)
+    let [parlnum, _] = s:SearchBracket(plnum, 'nbW')
     if parlnum > 0
       if a:0 > 0 && ExtraFunc(parlnum)
         " We may have found the opening brace of a bitbake Python task, e.g. 'python do_task {'
@@ -85,11 +100,7 @@ function python#GetIndent(lnum, ...)
     "       + b
     "       + c)
     call cursor(a:lnum, 1)
-    let p = searchpair('(\|{\|\[', '', ')\|}\|\]', 'bW',
-            \ "line('.') < " . (a:lnum - s:maxoff) . " ? dummy :"
-            \ . " synIDattr(synID(line('.'), col('.'), 1), 'name')"
-            \ . " =~ '\\(Comment\\|Todo\\|String\\)$'",
-            \ searchpair_stopline, searchpair_timeout)
+    let [p, _] = s:SearchBracket(a:lnum, 'bW')
     if p > 0
       if a:0 > 0 && ExtraFunc(p)
         " Currently only used by bitbake
@@ -109,11 +120,7 @@ function python#GetIndent(lnum, ...)
       else
         if p == plnum
           " When the start is inside parenthesis, only indent one 'shiftwidth'.
-          let pp = searchpair('(\|{\|\[', '', ')\|}\|\]', 'bW',
-              \ "line('.') < " . (a:lnum - s:maxoff) . " ? dummy :"
-              \ . " synIDattr(synID(line('.'), col('.'), 1), 'name')"
-              \ . " =~ '\\(Comment\\|Todo\\|String\\)$'",
-              \ searchpair_stopline, searchpair_timeout)
+          let [pp, _] = s:SearchBracket(a:lnum, 'bW')
           if pp > 0
             return indent(plnum) + (exists("g:pyindent_nested_paren") ? eval(g:pyindent_nested_paren) : shiftwidth())
           endif
@@ -136,12 +143,12 @@ function python#GetIndent(lnum, ...)
     " If the last character in the line is a comment, do a binary search for
     " the start of the comment.  synID() is slow, a linear search would take
     " too long on a long line.
-    if synIDattr(synID(plnum, pline_len, 1), "name") =~ "\\(Comment\\|Todo\\)$"
+    if synIDattr(synID(plnum, pline_len, 1), "name") =~ "\\(Comment\\|Todo\\)"
       let min = 1
       let max = pline_len
       while min < max
 	let col = (min + max) / 2
-	if synIDattr(synID(plnum, col, 1), "name") =~ "\\(Comment\\|Todo\\)$"
+	if synIDattr(synID(plnum, col, 1), "name") =~ "\\(Comment\\|Todo\\)"
 	  let max = col
 	else
 	  let min = col + 1
--- a/runtime/doc/help.txt
+++ b/runtime/doc/help.txt
@@ -26,6 +26,7 @@ Get specific help:  It is possible to go
 		      Option			  '	   :help 'textwidth'
 		      Regular expression	  /	   :help /[
 		    See |help-summary| for more contexts and an explanation.
+		    See |notation| for an explanation of the help syntax.
 
   Search for help:  Type ":help word", then hit CTRL-D to see matching
 		    help entries for "word".
--- a/runtime/doc/options.txt
+++ b/runtime/doc/options.txt
@@ -808,8 +808,33 @@ A jump table for the options with a shor
 	When on, Vim will change the current working directory whenever you
 	change the directory of the shell running in a terminal window. You
 	need proper setting-up, so whenever the shell's pwd changes an OSC 7
-	escape sequence will be emitted. For example, on Linux, you can source
-	/etc/profile.d/vte.sh in your shell profile if you use bash or zsh.
+	escape sequence will be emitted.  For example, on Linux, you can
+	source /etc/profile.d/vte.sh in your shell profile if you use bash or
+	zsh.  For bash this should work (put it in a bash init file): >
+		if [[ -n "$VIM_TERMINAL" ]]; then
+		    PROMPT_COMMAND='_vim_sync_PWD'
+		    function _vim_sync_PWD() {
+			printf "\033]7;file://%s\033\\" "$PWD"
+		    }
+		fi
+<
+	Or, in a zsh init file: >
+		if [[ -n "$VIM_TERMINAL" ]]; then
+		    autoload -Uz add-zsh-hook
+		    add-zsh-hook -Uz chpwd _vim_sync_PWD
+		    function _vim_sync_PWD() {
+			printf "\033]7;file://%s\033\\" "$PWD"
+		    }
+		fi
+<
+	In a fish init file: >
+		if test -n "$VIM_TERMINAL"
+		    function _vim_sync_PWD --on-variable=PWD
+			printf "\033]7;file://%s\033\\" "$PWD"
+		    end
+		end
+<
+	You can find an alternative method at |terminal-autoshelldir|.
 	When the parsing of the OSC sequence fails you get *E1179* .
 
 				*'arabic'* *'arab'* *'noarabic'* *'noarab'*
@@ -1767,7 +1792,8 @@ A jump table for the options with a shor
 	page can have a different value.
 
 	When 'cmdheight' is zero, there is no command-line unless it is being
-	used.  Any messages will cause the |hit-enter| prompt.
+	used.  Some informative messages will not be displayed, any other
+	messages will cause the |hit-enter| prompt.
 
 						*'cmdwinheight'* *'cwh'*
 'cmdwinheight' 'cwh'	number	(default 7)
@@ -5027,8 +5053,8 @@ A jump table for the options with a shor
 						*'lispwords'* *'lw'*
 'lispwords' 'lw'	string	(default is very long)
 			global or local to buffer |global-local|
-	Comma-separated list of words that influence the Lisp indenting.
-	|'lisp'|
+	Comma-separated list of words that influence the Lisp indenting when
+	enabled with the |'lisp'| option.
 
 						*'list'* *'nolist'*
 'list'			boolean	(default off)
@@ -7327,6 +7353,7 @@ A jump table for the options with a shor
 	Name of the word list file where words are added for the |zg| and |zw|
 	commands.  It must end in ".{encoding}.add".  You need to include the
 	path, otherwise the file is placed in the current directory.
+	The path may include characters from 'isfname', space, comma and '@'.
 								*E765*
 	It may also be a comma-separated list of names.  A count before the
 	|zg| and |zw| commands can be used to access each.  This allows using
--- a/runtime/doc/tags
+++ b/runtime/doc/tags
@@ -7900,6 +7900,7 @@ if_tcl.txt	if_tcl.txt	/*if_tcl.txt*
 ignore-errors	eval.txt	/*ignore-errors*
 ignore-timestamp	editing.txt	/*ignore-timestamp*
 import-legacy	vim9.txt	/*import-legacy*
+import-map	vim9.txt	/*import-map*
 improved-autocmds-5.4	version5.txt	/*improved-autocmds-5.4*
 improved-quickfix	version5.txt	/*improved-quickfix*
 improved-sessions	version5.txt	/*improved-sessions*
@@ -10086,6 +10087,7 @@ termdebug_use_prompt	terminal.txt	/*term
 termdebug_wide	terminal.txt	/*termdebug_wide*
 terminal	terminal.txt	/*terminal*
 terminal-api	terminal.txt	/*terminal-api*
+terminal-autoshelldir	terminal.txt	/*terminal-autoshelldir*
 terminal-client-server	terminal.txt	/*terminal-client-server*
 terminal-close	terminal.txt	/*terminal-close*
 terminal-colors	os_unix.txt	/*terminal-colors*
--- a/runtime/doc/terminal.txt
+++ b/runtime/doc/terminal.txt
@@ -1019,6 +1019,36 @@ A trick to have Vim send this escape seq
 
 Rationale: Why not allow for any command or expression?  Because that might
 create a security problem.
+						*terminal-autoshelldir*
+This can be used to pass the current directory from a shell to Vim.
+Put this in your .vimrc: >
+	def g:Tapi_lcd(_, args: string)
+	    execute 'silent lcd ' .. args
+	enddef
+<
+And, in a bash init file: >
+        if [[ -n "$VIM_TERMINAL" ]]; then
+            PROMPT_COMMAND='_vim_sync_PWD'
+            function _vim_sync_PWD() {
+              printf '\033]51;["call", "Tapi_lcd", "%q"]\007' "$PWD"
+            }
+        fi
+<
+Or, for zsh: >
+	if [[ -n "$VIM_TERMINAL" ]]; then
+	    autoload -Uz add-zsh-hook
+	    add-zsh-hook -Uz chpwd _vim_sync_PWD
+	    function _vim_sync_PWD() {
+		printf '\033]51;["call", "Tapi_lcd", "%q"]\007' "$PWD"
+	    }
+	fi
+<
+Or, for fish: >
+	if test -n "$VIM_TERMINAL"
+	    function _vim_sync_PWD --on-variable=PWD
+		printf '\033]51;["call", "Tapi_lcd", "%s"]\007' "$PWD"
+	    end
+	end
 
 
 Using the client-server feature ~
--- a/runtime/doc/todo.txt
+++ b/runtime/doc/todo.txt
@@ -38,20 +38,6 @@ browser use: https://github.com/vim/vim/
 							*known-bugs*
 -------------------- Known bugs and current work -----------------------
 
-Support virtual text:  #7553
-- Wrong cursor position in Insert mode, wrong pos after typing char #10786
-- implement "text_align" - right
-    when not truncated, may increase line height
-- implement "text_align" - below
-    need to compute extra screen line
-- implement "text_wrap" - truncate
-- when Tab is in text handle it like a space
-- Also consider an empty line, should fix #10786.  Also check inserting text.
-- win_lbr_chartabsize() TODO item: count screen cells
-- check that when inserting/deleting text col == MAXCOL isn't changed
-- wrong cursor position (Yegappan, July 27)
-- many tests
-
 Further Vim9 improvements, possibly after launch:
 - Use Vim9 for more runtime files.
 - Check performance with callgrind and kcachegrind.
@@ -129,19 +115,6 @@ Popup windows:
   Use ERROR_IF_POPUP_WINDOW for these.
 - Figure out the size and position better if wrapping inserts indent
 
-Text properties:
-- property is overruled by cursorline. (#8225).
-  Add better control over priority?  Make list of all highlighting, specify
-  where property fits in.
-  Or Should we let the textprop highlight overrule other (e.g. diff) highlight
-  if the priority is above a certain value?  (#7392)
-  Combining text property with 'cursorline' does not always work (Billie
-  Cleek, #5533)
-- Add text property that shifts text to make room for annotation (e.g.
-  variable type).  Like the opposite of conceal.  Requires fixing the cursor
-  positioning and mouse clicks as with conceal mode.
-- See remarks at top of src/textprop.c
-
 'incsearch' with :s:
 - :s/foo  using CTRL-G moves to another line, should not happen, or use the
   correct line (it uses the last but one line) (Lifepillar, Aug 18, #3345)
@@ -248,6 +221,7 @@ consistenly (James McCoy, #10698)
 
 To avoid flicker: add an option that when a screen clear is requested, instead
 of clearing it draws everything and uses "clear to end of line" for every line.
+Resetting 't_ut' already causes this?
 
 When scheme can't be found by configure there is no clear "not found" message:
     configure:5769: checking MzScheme install prefix
@@ -2679,6 +2653,8 @@ Better 'rightleft' or BIDI support:
 
 
 Spell checking:
+-   [s does not find missing capital at start of the line.  #10838
+    Probably because the dot at the end of the previous line isn't seen.
 -   When 'cursorline' is set and the first word should have SpellCap
     highlighting, redrawing the line removes it when moving the cursor away
     from the line. (#7085)  Would need to inspect the end of the previous line
@@ -3784,6 +3760,7 @@ 8   Make the foreground color darkening 
 Syntax highlighting:
     Long term goal: faster, better, etc.  Options:
     - use treesitter, NeoVim uses it - Many people don't like it.
+	After changes requires rebuilding the library.
     - use TextMate, vscode uses it.  #9087 - Other people don't like it.
       Vscode is asked to switch to treesitter:
       https://github.com/microsoft/vscode/issues/50140
--- a/runtime/doc/usr_41.txt
+++ b/runtime/doc/usr_41.txt
@@ -268,14 +268,15 @@ when it doesn't, append !: >
 You cannot `unlet` script-local variables in |Vim9| script, only in legacy
 script.
 
-When a script finishes, the local variables declared there will not be
-deleted.  Functions defined in the script can use them.  Example:
+When a script has been processed to the end, the local variables declared
+there will not be deleted.  Functions defined in the script can use them.
+Example:
 >
 	vim9script
 	var counter = 0
 	def g:GetCount(): number
-	  s:counter += 1
-	  return s:counter
+	  counter += 1
+	  return counter
 	enddef
 
 Every time you call the function it will return the next count: >
--- a/runtime/doc/vim9.txt
+++ b/runtime/doc/vim9.txt
@@ -1773,7 +1773,7 @@ line, there can be no line break: >
 		name   # Error!
 	echo that
 		.name  # Error!
-
+<						*import-map*
 When you've imported a function from one script into a vim9 script you can
 refer to the imported function in a mapping by prefixing it with |<SID>|: >
 	noremap <silent> ,a :call <SID>name.Function()<CR>
--- a/runtime/ftplugin/abaqus.vim
+++ b/runtime/ftplugin/abaqus.vim
@@ -1,7 +1,7 @@
 " Vim filetype plugin file
 " Language:     Abaqus finite element input file (www.abaqus.com)
-" Maintainer:   Carl Osterwisch <osterwischc@asme.org>
-" Last Change:  2022 May 09
+" Maintainer:   Carl Osterwisch <costerwi@gmail.com>
+" Last Change:  2022 Aug 03
 
 " Only do this when not done yet for this buffer
 if exists("b:did_ftplugin") | finish | endif
@@ -46,7 +46,7 @@ if has("folding")
 endif
 
 " Set the file browse filter (currently only supported under Win32 gui)
-if has("gui_win32") && !exists("b:browsefilter")
+if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter")
     let b:browsefilter = "Abaqus Input Files (*.inp *.inc)\t*.inp;*.inc\n" .
     \ "Abaqus Results (*.dat)\t*.dat\n" .
     \ "Abaqus Messages (*.pre *.msg *.sta)\t*.pre;*.msg;*.sta\n" .
@@ -57,7 +57,7 @@ endif
 " Define patterns for the matchit plugin
 if exists("loaded_matchit") && !exists("b:match_words")
     let b:match_ignorecase = 1
-    let b:match_words = 
+    let b:match_words =
     \ '\*part:\*end\s*part,' .
     \ '\*assembly:\*end\s*assembly,' .
     \ '\*instance:\*end\s*instance,' .
@@ -65,25 +65,27 @@ if exists("loaded_matchit") && !exists("
     let b:undo_ftplugin .= "|unlet! b:match_ignorecase b:match_words"
 endif
 
-" Define keys used to move [count] keywords backward or forward.
-noremap <silent><buffer> [[ ?^\*\a<CR>:nohlsearch<CR>
-noremap <silent><buffer> ]] /^\*\a<CR>:nohlsearch<CR>
+if !exists("no_plugin_maps") && !exists("no_abaqus_maps")
+  " Define keys used to move [count] keywords backward or forward.
+  noremap <silent><buffer> [[ ?^\*\a<CR>:nohlsearch<CR>
+  noremap <silent><buffer> ]] /^\*\a<CR>:nohlsearch<CR>
 
-" Define key to toggle commenting of the current line or range
-noremap <silent><buffer> <LocalLeader><LocalLeader> 
-    \ :call <SID>Abaqus_ToggleComment()<CR>j
-function! <SID>Abaqus_ToggleComment() range
-    if strpart(getline(a:firstline), 0, 2) == "**"
-        " Un-comment all lines in range
-        silent execute a:firstline . ',' . a:lastline . 's/^\*\*//'
-    else
-        " Comment all lines in range
-        silent execute a:firstline . ',' . a:lastline . 's/^/**/'
-    endif
-endfunction
+  " Define key to toggle commenting of the current line or range
+  noremap <silent><buffer> <LocalLeader><LocalLeader>
+      \ :call <SID>Abaqus_ToggleComment()<CR>j
+  function! <SID>Abaqus_ToggleComment() range
+      if strpart(getline(a:firstline), 0, 2) == "**"
+	  " Un-comment all lines in range
+	  silent execute a:firstline . ',' . a:lastline . 's/^\*\*//'
+      else
+	  " Comment all lines in range
+	  silent execute a:firstline . ',' . a:lastline . 's/^/**/'
+      endif
+  endfunction
 
-let b:undo_ftplugin .= "|unmap <buffer> [[|unmap <buffer> ]]"
-    \ . "|unmap <buffer> <LocalLeader><LocalLeader>"
+  let b:undo_ftplugin .= "|unmap <buffer> [[|unmap <buffer> ]]"
+      \ . "|unmap <buffer> <LocalLeader><LocalLeader>"
+endif
 
 " Undo must be done in nocompatible mode for <LocalLeader>.
 let b:undo_ftplugin = "let b:cpo_save = &cpoptions|"
--- a/runtime/ftplugin/php.vim
+++ b/runtime/ftplugin/php.vim
@@ -1,12 +1,12 @@
 " Vim filetype plugin file
-" Language:	php
-"
-" This runtime file is looking for a new maintainer.
-"
-" Former maintainer:	Dan Sharp
-" Last Changed: 20 Jan 2009
+" Language:		PHP
+" Maintainer:		Doug Kearns <dougkearns@gmail.com>
+" Previous Maintainer:	Dan Sharp
+" Last Changed:		2022 Jul 20
 
-if exists("b:did_ftplugin") | finish | endif
+if exists("b:did_ftplugin")
+  finish
+endif
 
 " Make sure the continuation lines below do not cause problems in
 " compatibility mode.
@@ -15,8 +15,8 @@ set cpo&vim
 
 " Define some defaults in case the included ftplugins don't set them.
 let s:undo_ftplugin = ""
-let s:browsefilter = "HTML Files (*.html, *.htm)\t*.html;*.htm\n" .
-	    \	     "All Files (*.*)\t*.*\n"
+let s:browsefilter = "HTML Files (*.html, *.htm)\t*.html;*.htm\n" ..
+      \		     "All Files (*.*)\t*.*\n"
 let s:match_words = ""
 
 runtime! ftplugin/html.vim ftplugin/html_*.vim ftplugin/html/*.vim
@@ -24,63 +24,130 @@ let b:did_ftplugin = 1
 
 " Override our defaults if these were set by an included ftplugin.
 if exists("b:undo_ftplugin")
-    let s:undo_ftplugin = b:undo_ftplugin
+" let b:undo_ftplugin = "setlocal comments< commentstring< formatoptions< omnifunc<"
+  let s:undo_ftplugin = b:undo_ftplugin
 endif
 if exists("b:browsefilter")
-    let s:browsefilter = b:browsefilter
+" let b:undo_ftplugin ..= " | unlet! b:browsefilter b:html_set_browsefilter"
+  let s:browsefilter = b:browsefilter
 endif
 if exists("b:match_words")
-    let s:match_words = b:match_words
+" let b:undo_ftplugin ..= " | unlet! b:match_ignorecase b:match_words b:html_set_match_words"
+  let s:match_words = b:match_words
 endif
 if exists("b:match_skip")
-    unlet b:match_skip
+  unlet b:match_skip
 endif
 
-" Change the :browse e filter to primarily show PHP-related files.
-if has("gui_win32")
-    let  b:browsefilter="PHP Files (*.php)\t*.php\n" . s:browsefilter
+setlocal comments=s1:/*,mb:*,ex:*/,://,:#
+setlocal commentstring=/*%s*/
+setlocal formatoptions+=l formatoptions-=t
+
+if get(g:, "php_autocomment", 1)
+  setlocal formatoptions+=croq
+  " NOTE: set g:PHP_autoformatcomment = 0 to prevent the indent plugin from
+  "       overriding this 'comments' value 
+  setlocal comments-=:#
+  " space after # comments to exclude attributes
+  setlocal comments+=b:#
 endif
 
+if exists('&omnifunc')
+  setlocal omnifunc=phpcomplete#CompletePHP
+endif
+
+setlocal suffixesadd=.php
+
 " ###
 " Provided by Mikolaj Machowski <mikmach at wp dot pl>
 setlocal include=\\\(require\\\|include\\\)\\\(_once\\\)\\\?
 " Disabled changing 'iskeyword', it breaks a command such as "*"
 " setlocal iskeyword+=$
 
-if exists("loaded_matchit")
-    let b:match_words = '<?php:?>,\<switch\>:\<endswitch\>,' .
-		      \ '\<if\>:\<elseif\>:\<else\>:\<endif\>,' .
-		      \ '\<while\>:\<endwhile\>,' .
-		      \ '\<do\>:\<while\>,' .
-		      \ '\<for\>:\<endfor\>,' .
-		      \ '\<foreach\>:\<endforeach\>,' .
-                      \ '(:),[:],{:},' .
-		      \ s:match_words
+let b:undo_ftplugin = "setlocal include< suffixesadd<"
+
+if exists("loaded_matchit") && exists("b:html_set_match_words")
+  let b:match_ignorecase = 1
+  let b:match_words = 'PhpMatchWords()'
+
+  if !exists("*PhpMatchWords")
+    function! PhpMatchWords()
+      " The PHP syntax file uses the Delimiter syntax group for the phpRegion
+      " matchgroups, without a "php" prefix, so use the stack to test for the
+      " outer phpRegion group.	This also means the closing ?> tag which is
+      " outside of the matched region just uses the Delimiter group for the
+      " end match.
+      let stack = synstack(line('.'), col('.'))
+      let php_region = !empty(stack) && synIDattr(stack[0], "name") =~# '\<php'
+      if php_region || getline(".") =~ '.\=\%.c\&?>'
+	let b:match_skip = "PhpMatchSkip('html')"
+	return '<?php\|<?=\=:?>,' ..
+	   \   '\<if\>:\<elseif\>:\<else\>:\<endif\>,' ..
+	   \   '\<switch\>:\<case\>:\<break\>:\<continue\>:\<endswitch\>,' ..
+	   \   '\<while\>.\{-})\s*\::\<break\>:\<continue\>:\<endwhile\>,' ..
+	   \   '\<do\>:\<break\>:\<continue\>:\<while\>,' ..
+	   \   '\<for\>:\<break\>:\<continue\>:\<endfor\>,' ..
+	   \   '\<foreach\>:\<break\>:\<continue\>:\<endforeach\>,' ..
+	   \   '\%(<<<\s*\)\@<=''\=\(\h\w*\)''\=:^\s*\1\>'
+
+	   " TODO: these probably aren't worth adding and really need syntax support
+	   "   '<\_s*script\_s*language\_s*=\_s*[''"]\=\_s*php\_s*[''"]\=\_s*>:<\_s*\_s*/\_s*script\_s*>,' ..
+	   "   '<%:%>,' ..
+      else
+	let b:match_skip = "PhpMatchSkip('php')"
+	return s:match_words
+      endif
+    endfunction
+  endif
+  if !exists("*PhpMatchSkip")
+    function! PhpMatchSkip(skip)
+      let name = synIDattr(synID(line('.'), col('.'), 1), 'name')
+      if a:skip == "html"
+	" ?> in line comments will also be correctly matched as Delimiter
+	return name =~? 'comment\|string' || name !~? 'php\|delimiter'
+      else " php
+	return name =~? 'comment\|string\|php'
+      endif
+    endfunction
+  endif
+  let b:undo_ftplugin ..= " | unlet! b:match_skip"
 endif
 " ###
 
-if exists('&omnifunc')
-  setlocal omnifunc=phpcomplete#CompletePHP
+" Change the :browse e filter to primarily show PHP-related files.
+if (has("gui_win32") || has("gui_gtk")) && exists("b:html_set_browsefilter")
+  let b:browsefilter = "PHP Files (*.php)\t*.php\n" ..
+	\	       "PHP Test Files (*.phpt)\t*.phpt\n" ..
+	\	       s:browsefilter
 endif
 
-" Section jumping: [[ and ]] provided by Antony Scriven <adscriven at gmail dot com>
-let s:function = '\(abstract\s\+\|final\s\+\|private\s\+\|protected\s\+\|public\s\+\|static\s\+\)*function'
-let s:class = '\(abstract\s\+\|final\s\+\)*class'
-let s:interface = 'interface'
-let s:section = '\(.*\%#\)\@!\_^\s*\zs\('.s:function.'\|'.s:class.'\|'.s:interface.'\)'
-exe 'nno <buffer> <silent> [[ ?' . escape(s:section, '|') . '?<CR>:nohls<CR>'
-exe 'nno <buffer> <silent> ]] /' . escape(s:section, '|') . '/<CR>:nohls<CR>'
-exe 'ono <buffer> <silent> [[ ?' . escape(s:section, '|') . '?<CR>:nohls<CR>'
-exe 'ono <buffer> <silent> ]] /' . escape(s:section, '|') . '/<CR>:nohls<CR>'
+if !exists("no_plugin_maps") && !exists("no_php_maps")
+  " Section jumping: [[ and ]] provided by Antony Scriven <adscriven at gmail dot com>
+  let s:function = '\%(abstract\s\+\|final\s\+\|private\s\+\|protected\s\+\|public\s\+\|static\s\+\)*function'
+  let s:class = '\%(abstract\s\+\|final\s\+\)*class'
+  let s:section = escape('^\s*\zs\%(' .. s:function .. '\|' .. s:class .. '\|interface\|trait\|enum\)\>', "|")
 
-setlocal suffixesadd=.php
-setlocal commentstring=/*%s*/
+  function! s:Jump(pattern, count, flags)
+    normal! m'
+    for i in range(a:count)
+      if !search(a:pattern, a:flags)
+	break
+      endif
+    endfor
+  endfunction
 
-" Undo the stuff we changed.
-let b:undo_ftplugin = "setlocal suffixesadd< commentstring< include< omnifunc<" .
-	    \	      " | unlet! b:browsefilter b:match_words | " .
-	    \	      s:undo_ftplugin
+  for mode in ["n", "o", "x"]
+    exe mode .. "noremap <buffer> <silent> ]] <Cmd>call <SID>Jump('" .. s:section .. "', v:count1, 'W')<CR>"
+    exe mode .. "noremap <buffer> <silent> [[ <Cmd>call <SID>Jump('" .. s:section .. "', v:count1, 'bW')<CR>"
+    let b:undo_ftplugin ..= " | sil! exe '" .. mode .. "unmap <buffer> ]]'" ..
+	  \		    " | sil! exe '" .. mode .. "unmap <buffer> [['"
+  endfor
+endif
+
+let b:undo_ftplugin ..= " | " .. s:undo_ftplugin
 
 " Restore the saved compatibility options.
 let &cpo = s:keepcpo
 unlet s:keepcpo
+
+" vim: nowrap sw=2 sts=2 ts=8 noet:
--- a/runtime/ftplugin/vim.vim
+++ b/runtime/ftplugin/vim.vim
@@ -1,7 +1,7 @@
 " Vim filetype plugin
 " Language:	Vim
 " Maintainer:	Bram Moolenaar <Bram@vim.org>
-" Last Change:	2021 Apr 11
+" Last Change:	2022 Aug 4
 
 " Only do this when not done yet for this buffer
 if exists("b:did_ftplugin")
@@ -110,7 +110,7 @@ if exists("loaded_matchit")
   " - set spl=de,en
   " - au! FileType javascript syntax region foldBraces start=/{/ end=/}/ …
   let b:match_skip = 'synIDattr(synID(line("."),col("."),1),"name")
-        \ =~? "comment\\|string\\|vimSynReg\\|vimSet"'
+        \ =~? "comment\\|string\\|vimLetHereDoc\\|vimSynReg\\|vimSet"'
 endif
 
 let &cpo = s:cpo_save
--- a/runtime/indent/lisp.vim
+++ b/runtime/indent/lisp.vim
@@ -1,7 +1,7 @@
 " Vim indent file
 " Language:	Lisp
-" Maintainer:    Sergey Khorev <sergey.khorev@gmail.com>
-" URL:		 http://sites.google.com/site/khorser/opensource/vim
+" Maintainer:	Sergey Khorev <sergey.khorev@gmail.com>
+" URL:		http://sites.google.com/site/khorser/opensource/vim
 " Last Change:	2012 Jan 10
 
 " Only load this indent file when no other was loaded.
--- a/runtime/indent/systemverilog.vim
+++ b/runtime/indent/systemverilog.vim
@@ -2,7 +2,7 @@
 " Language:    SystemVerilog
 " Maintainer:  kocha <kocha.lsifrontend@gmail.com>
 " Last Change: 05-Feb-2017 by Bilal Wasim
-"		2022 April: b:undo_indent added by Doug Kearns
+"              03-Aug-2022 Improved indent
 
 " Only load this indent file when no other was loaded.
 if exists("b:did_indent")
@@ -15,7 +15,7 @@ setlocal indentkeys=!^F,o,O,0),0},=begin
 setlocal indentkeys+==endmodule,=endfunction,=endtask,=endspecify
 setlocal indentkeys+==endclass,=endpackage,=endsequence,=endclocking
 setlocal indentkeys+==endinterface,=endgroup,=endprogram,=endproperty,=endchecker
-setlocal indentkeys+==`else,=`endif
+setlocal indentkeys+==`else,=`elsif,=`endif
 
 let b:undo_indent = "setl inde< indk<"
 
@@ -27,6 +27,9 @@ endif
 let s:cpo_save = &cpo
 set cpo&vim
 
+let s:multiple_comment = 0
+let s:open_statement = 0
+
 function SystemVerilogIndent()
 
   if exists('b:systemverilog_indent_width')
@@ -40,6 +43,12 @@ function SystemVerilogIndent()
     let indent_modules = 0
   endif
 
+  if exists('b:systemverilog_indent_ifdef_off')
+    let indent_ifdef = 0
+  else
+    let indent_ifdef = 1
+  endif
+
   " Find a non-blank line above the current line.
   let lnum = prevnonblank(v:lnum - 1)
 
@@ -54,48 +63,55 @@ function SystemVerilogIndent()
   let last_line2 = getline(lnum2)
   let ind  = indent(lnum)
   let ind2 = indent(lnum - 1)
-  let offset_comment1 = 1
   " Define the condition of an open statement
   "   Exclude the match of //, /* or */
   let sv_openstat = '\(\<or\>\|\([*/]\)\@<![*(,{><+-/%^&|!=?:]\([*/]\)\@!\)'
   " Define the condition when the statement ends with a one-line comment
   let sv_comment = '\(//.*\|/\*.*\*/\s*\)'
-  if exists('b:verilog_indent_verbose')
-    let vverb_str = 'INDENT VERBOSE:'
+  if exists('b:systemverilog_indent_verbose')
+    let vverb_str = 'INDENT VERBOSE: '. v:lnum .":"
     let vverb = 1
   else
     let vverb = 0
   endif
 
-  " Indent according to last line
-  " End of multiple-line comment
-  if last_line =~ '\*/\s*$' && last_line !~ '/\*.\{-}\*/'
-    let ind = ind - offset_comment1
-    if vverb
-      echo vverb_str "De-indent after a multiple-line comment."
-    endif
+  " Multiple-line comment count
+  if curr_line =~ '^\s*/\*' && curr_line !~ '/\*.\{-}\*/'
+    let s:multiple_comment += 1
+    if vverb | echom vverb_str "Start of multiple-line commnt" | endif
+  elseif curr_line =~ '\*/\s*$' && curr_line !~ '/\*.\{-}\*/'
+    let s:multiple_comment -= 1
+    if vverb | echom vverb_str "End of multiple-line commnt" | endif
+    return ind
+  endif
+  " Maintain indentation during commenting.
+  if s:multiple_comment > 0
+    return ind
+  endif
 
   " Indent after if/else/for/case/always/initial/specify/fork blocks
-  elseif last_line =~ '`\@<!\<\(if\|else\)\>' ||
-    \ last_line =~ '^\s*\<\(for\|case\%[[zx]]\|do\|foreach\|forever\|randcase\)\>' ||
+  if last_line =~ '^\s*\(end\)\=\s*`\@<!\<\(if\|else\)\>' ||
+    \ last_line =~ '^\s*\<\(for\|while\|repeat\|case\%[[zx]]\|do\|foreach\|forever\|randcase\)\>' ||
     \ last_line =~ '^\s*\<\(always\|always_comb\|always_ff\|always_latch\)\>' ||
     \ last_line =~ '^\s*\<\(initial\|specify\|fork\|final\)\>'
-    if last_line !~ '\(;\|\<end\>\)\s*' . sv_comment . '*$' ||
+    if last_line !~ '\(;\|\<end\>\|\*/\)\s*' . sv_comment . '*$' ||
       \ last_line =~ '\(//\|/\*\).*\(;\|\<end\>\)\s*' . sv_comment . '*$'
       let ind = ind + offset
-      if vverb | echo vverb_str "Indent after a block statement." | endif
+      if vverb | echom vverb_str "Indent after a block statement." | endif
     endif
   " Indent after function/task/class/package/sequence/clocking/
   " interface/covergroup/property/checkerprogram blocks
   elseif last_line =~ '^\s*\<\(function\|task\|class\|package\)\>' ||
     \ last_line =~ '^\s*\<\(sequence\|clocking\|interface\)\>' ||
     \ last_line =~ '^\s*\(\w\+\s*:\)\=\s*\<covergroup\>' ||
-    \ last_line =~ '^\s*\<\(property\|checker\|program\)\>'
+    \ last_line =~ '^\s*\<\(property\|checker\|program\)\>' ||
+    \ ( last_line =~ '^\s*\<virtual\>' && last_line =~ '\<\(function\|task\|class\|interface\)\>' ) ||
+    \ ( last_line =~ '^\s*\<pure\>' &&  last_line =~ '\<virtual\>' && last_line =~ '\<\(function\|task\)\>' )
     if last_line !~ '\<end\>\s*' . sv_comment . '*$' ||
       \ last_line =~ '\(//\|/\*\).*\(;\|\<end\>\)\s*' . sv_comment . '*$'
       let ind = ind + offset
       if vverb
-	echo vverb_str "Indent after function/task/class block statement."
+        echom vverb_str "Indent after function/task/class block statement."
       endif
     endif
 
@@ -103,13 +119,13 @@ function SystemVerilogIndent()
   elseif last_line =~ '^\s*\(\<extern\>\s*\)\=\<module\>'
     let ind = ind + indent_modules
     if vverb && indent_modules
-      echo vverb_str "Indent after module statement."
+      echom vverb_str "Indent after module statement."
     endif
     if last_line =~ '[(,]\s*' . sv_comment . '*$' &&
       \ last_line !~ '\(//\|/\*\).*[(,]\s*' . sv_comment . '*$'
       let ind = ind + offset
       if vverb
-	echo vverb_str "Indent after a multiple-line module statement."
+        echom vverb_str "Indent after a multiple-line module statement."
       endif
     endif
 
@@ -119,7 +135,7 @@ function SystemVerilogIndent()
     \ ( last_line2 !~ sv_openstat . '\s*' . sv_comment . '*$' ||
     \ last_line2 =~ '^\s*[^=!]\+\s*:\s*' . sv_comment . '*$' )
     let ind = ind + offset
-    if vverb | echo vverb_str "Indent after begin statement." | endif
+    if vverb | echom vverb_str "Indent after begin statement." | endif
 
   " Indent after a '{' or a '('
   elseif last_line =~ '[{(]' . sv_comment . '*$' &&
@@ -127,7 +143,21 @@ function SystemVerilogIndent()
     \ ( last_line2 !~ sv_openstat . '\s*' . sv_comment . '*$' ||
     \ last_line2 =~ '^\s*[^=!]\+\s*:\s*' . sv_comment . '*$' )
     let ind = ind + offset
-    if vverb | echo vverb_str "Indent after begin statement." | endif
+    if vverb | echom vverb_str "Indent after begin statement." | endif
+
+  " Ignore de-indent for the end of one-line block
+  elseif ( last_line !~ '\<begin\>' ||
+    \ last_line =~ '\(//\|/\*\).*\<begin\>' ) &&
+    \ last_line2 =~ '\<\(`\@<!if\|`\@<!else\|for\|always\|initial\|do\|foreach\|forever\|final\)\>.*' .
+      \ sv_comment . '*$' &&
+    \ last_line2 !~ '\(//\|/\*\).*\<\(`\@<!if\|`\@<!else\|for\|always\|initial\|do\|foreach\|forever\|final\)\>' &&
+    \ last_line2 !~ sv_openstat . '\s*' . sv_comment . '*$' &&
+    \ ( last_line2 !~ '\<begin\>' ||
+    \ last_line2 =~ '\(//\|/\*\).*\<begin\>' ) &&
+    \ last_line2 =~ ')*\s*;\s*' . sv_comment . '*$'
+    if vverb
+      echom vverb_str "Ignore de-indent after the end of one-line statement."
+    endif
 
   " De-indent for the end of one-line block
   elseif ( last_line !~ '\<begin\>' ||
@@ -136,39 +166,29 @@ function SystemVerilogIndent()
       \ sv_comment . '*$' &&
     \ last_line2 !~ '\(//\|/\*\).*\<\(`\@<!if\|`\@<!else\|for\|always\|initial\|do\|foreach\|forever\|final\)\>' &&
     \ last_line2 !~ sv_openstat . '\s*' . sv_comment . '*$' &&
+    \ last_line2 !~ '\(;\|\<end\>\|\*/\)\s*' . sv_comment . '*$' &&
     \ ( last_line2 !~ '\<begin\>' ||
     \ last_line2 =~ '\(//\|/\*\).*\<begin\>' )
     let ind = ind - offset
     if vverb
-      echo vverb_str "De-indent after the end of one-line statement."
+      echom vverb_str "De-indent after the end of one-line statement."
     endif
 
-    " Multiple-line statement (including case statement)
-    " Open statement
-    "   Ident the first open line
-    elseif  last_line =~ sv_openstat . '\s*' . sv_comment . '*$' &&
-      \ last_line !~ '\(//\|/\*\).*' . sv_openstat . '\s*$' &&
-      \ last_line2 !~ sv_openstat . '\s*' . sv_comment . '*$'
-      let ind = ind + offset
-      if vverb | echo vverb_str "Indent after an open statement." | endif
+  " Multiple-line statement (including case statement)
+  " Open statement
+  "   Ident the first open line
+  elseif  last_line =~ sv_openstat . '\s*' . sv_comment . '*$' &&
+   \ last_line !~ '\(//\|/\*\).*' . sv_openstat . '\s*$' &&
+   \ last_line2 !~ sv_openstat . '\s*' . sv_comment . '*$'
+    let ind = ind + offset
+    let s:open_statement = 1
+    if vverb | echom vverb_str "Indent after an open statement." | endif
 
-    " Close statement
-    "   De-indent for an optional close parenthesis and a semicolon, and only
-    "   if there exists precedent non-whitespace char
-    elseif last_line =~ ')*\s*;\s*' . sv_comment . '*$' &&
-      \ last_line !~ '^\s*)*\s*;\s*' . sv_comment . '*$' &&
-      \ last_line !~ '\(//\|/\*\).*\S)*\s*;\s*' . sv_comment . '*$' &&
-      \ ( last_line2 =~ sv_openstat . '\s*' . sv_comment . '*$' &&
-      \ last_line2 !~ ';\s*//.*$') &&
-      \ last_line2 !~ '^\s*' . sv_comment . '$'
-      let ind = ind - offset
-      if vverb | echo vverb_str "De-indent after a close statement." | endif
-
-  " `ifdef and `else
-  elseif last_line =~ '^\s*`\<\(ifdef\|else\)\>'
+  " `ifdef or `ifndef or `elsif or `else
+  elseif last_line =~ '^\s*`\<\(ifn\?def\|elsif\|else\)\>' && indent_ifdef
     let ind = ind + offset
     if vverb
-      echo vverb_str "Indent after a `ifdef or `else statement."
+      echom vverb_str "Indent after a `ifdef or `ifndef or `elsif or `else statement."
     endif
 
   endif
@@ -177,17 +197,21 @@ function SystemVerilogIndent()
 
   " De-indent on the end of the block
   " join/end/endcase/endfunction/endtask/endspecify
-  if curr_line =~ '^\s*\<\(join\|join_any\|join_none\|\|end\|endcase\|while\)\>' ||
+  if curr_line =~ '^\s*\<\(join\|join_any\|join_none\|\|end\|endcase\)\>' ||
       \ curr_line =~ '^\s*\<\(endfunction\|endtask\|endspecify\|endclass\)\>' ||
       \ curr_line =~ '^\s*\<\(endpackage\|endsequence\|endclocking\|endinterface\)\>' ||
-      \ curr_line =~ '^\s*\<\(endgroup\|endproperty\|endchecker\|endprogram\)\>' ||
-      \ curr_line =~ '^\s*}'
+      \ curr_line =~ '^\s*\<\(endgroup\|endproperty\|endchecker\|endprogram\)\>'
     let ind = ind - offset
-    if vverb | echo vverb_str "De-indent the end of a block." | endif
+    if vverb | echom vverb_str "De-indent the end of a block." | endif
+    if s:open_statement == 1
+      let ind = ind - offset
+      let s:open_statement = 0
+      if vverb | echom vverb_str "De-indent the close statement." | endif
+    endif
   elseif curr_line =~ '^\s*\<endmodule\>'
     let ind = ind - indent_modules
     if vverb && indent_modules
-      echo vverb_str "De-indent the end of a module."
+      echom vverb_str "De-indent the end of a module."
     endif
 
   " De-indent on a stand-alone 'begin'
@@ -202,25 +226,46 @@ function SystemVerilogIndent()
       \ last_line =~ sv_openstat . '\s*' . sv_comment . '*$' )
       let ind = ind - offset
       if vverb
-	echo vverb_str "De-indent a stand alone begin statement."
+        echom vverb_str "De-indent a stand alone begin statement."
+      endif
+      if s:open_statement == 1
+        let ind = ind - offset
+        let s:open_statement = 0
+        if vverb | echom vverb_str "De-indent the close statement." | endif
       endif
     endif
 
-  " De-indent after the end of multiple-line statement
-  elseif curr_line =~ '^\s*)' &&
-    \ ( last_line =~ sv_openstat . '\s*' . sv_comment . '*$' ||
-    \ last_line !~ sv_openstat . '\s*' . sv_comment . '*$' &&
-    \ last_line2 =~ sv_openstat . '\s*' . sv_comment . '*$' )
+  " " Close statement
+  " "   De-indent for an optional close parenthesis and a semicolon, and only
+  " "   if there exists precedent non-whitespace char
+  " elseif last_line =~ ')*\s*;\s*' . sv_comment . '*$' &&
+  "   \ last_line !~ '^\s*)*\s*;\s*' . sv_comment . '*$' &&
+  "   \ last_line !~ '\(//\|/\*\).*\S)*\s*;\s*' . sv_comment . '*$' &&
+  "   \ ( last_line2 =~ sv_openstat . '\s*' . sv_comment . '*$' &&
+  "   \ last_line2 !~ ';\s*//.*$') &&
+  "   \ last_line2 !~ '^\s*' . sv_comment . '$'
+  "   let ind = ind - offset
+  "   if vverb | echom vverb_str "De-indent after a close statement." | endif
+
+  " " De-indent after the end of multiple-line statement
+  " elseif curr_line =~ '^\s*)' &&
+  "  \ ( last_line =~ sv_openstat . '\s*' . sv_comment . '*$' ||
+  "  \ last_line !~ sv_openstat . '\s*' . sv_comment . '*$' &&
+  "  \ last_line2 =~ sv_openstat . '\s*' . sv_comment . '*$' )
+  "   let ind = ind - offset
+  "   if vverb
+  "     echom vverb_str "De-indent the end of a multiple statement."
+  "   endif
+
+  " De-indent `elsif or `else or `endif
+  elseif curr_line =~ '^\s*`\<\(elsif\|else\|endif\)\>' && indent_ifdef
     let ind = ind - offset
-    if vverb
-      echo vverb_str "De-indent the end of a multiple statement."
+    if vverb | echom vverb_str "De-indent `elsif or `else or `endif statement." | endif
+    if b:systemverilog_open_statement == 1
+      let ind = ind - offset
+      let b:systemverilog_open_statement = 0
+      if vverb | echom vverb_str "De-indent the open statement." | endif
     endif
-
-  " De-indent `else and `endif
-  elseif curr_line =~ '^\s*`\<\(else\|endif\)\>'
-    let ind = ind - offset
-    if vverb | echo vverb_str "De-indent `else and `endif statement." | endif
-
   endif
 
   " Return the indentation
@@ -231,3 +276,4 @@ let &cpo = s:cpo_save
 unlet s:cpo_save
 
 " vim:sw=2
+
new file mode 100644
--- /dev/null
+++ b/runtime/indent/testdir/python.in
@@ -0,0 +1,68 @@
+" vim: set ft=python sw=4 et:
+
+" START_INDENT
+open_paren_not_at_EOL(100,
+(200,
+300),
+400)
+
+open_paren_at_EOL(
+100, 200, 300, 400)
+
+open_paren_not_at_EOL(100,
+(200,
+300),
+400)
+
+open_paren_at_EOL(
+100, 200, 300, 400)
+
+open_paren_not_at_EOL(100,
+(200,
+300),
+400)
+
+open_paren_at_EOL(
+100, 200, 300, 400)
+
+open_paren_not_at_EOL(100,
+(200,
+300),
+400)
+
+open_paren_at_EOL(
+100, 200, 300, 400)
+
+open_paren_not_at_EOL(100,
+(200,
+300),
+400)
+
+open_paren_at_EOL(
+100, 200, 300, 400)
+
+open_paren_not_at_EOL(100,
+(200,
+300),
+400)
+
+open_paren_at_EOL(
+100, 200, 300, 400)
+
+open_paren_not_at_EOL(100,
+(200,
+300),
+400)
+
+open_paren_at_EOL(
+100, 200, 300, 400)
+
+open_paren_not_at_EOL(100,
+(200,
+300),
+400)
+
+open_paren_at_EOL(
+100, 200, 300, 400)
+
+" END_INDENT
new file mode 100644
--- /dev/null
+++ b/runtime/indent/testdir/python.ok
@@ -0,0 +1,68 @@
+" vim: set ft=python sw=4 et:
+
+" START_INDENT
+open_paren_not_at_EOL(100,
+                      (200,
+                       300),
+                      400)
+
+open_paren_at_EOL(
+        100, 200, 300, 400)
+
+open_paren_not_at_EOL(100,
+                      (200,
+                       300),
+                      400)
+
+open_paren_at_EOL(
+        100, 200, 300, 400)
+
+open_paren_not_at_EOL(100,
+                      (200,
+                       300),
+                      400)
+
+open_paren_at_EOL(
+        100, 200, 300, 400)
+
+open_paren_not_at_EOL(100,
+                      (200,
+                       300),
+                      400)
+
+open_paren_at_EOL(
+        100, 200, 300, 400)
+
+open_paren_not_at_EOL(100,
+                      (200,
+                       300),
+                      400)
+
+open_paren_at_EOL(
+        100, 200, 300, 400)
+
+open_paren_not_at_EOL(100,
+                      (200,
+                       300),
+                      400)
+
+open_paren_at_EOL(
+        100, 200, 300, 400)
+
+open_paren_not_at_EOL(100,
+                      (200,
+                       300),
+                      400)
+
+open_paren_at_EOL(
+        100, 200, 300, 400)
+
+open_paren_not_at_EOL(100,
+                      (200,
+                       300),
+                      400)
+
+open_paren_at_EOL(
+        100, 200, 300, 400)
+
+" END_INDENT
--- a/runtime/pack/dist/opt/matchit/doc/matchit.txt
+++ b/runtime/pack/dist/opt/matchit/doc/matchit.txt
@@ -244,9 +244,6 @@ Examples:
 	comment character) you can >
 		:let b:match_skip = 'r:\(^\|[^\\]\)\(\\\\\)*%'
 <
-	See the $VIMRUNTIME/ftplugin/vim.vim for an example that uses both
-	syntax and a regular expression.
-
 ==============================================================================
 4. Supporting a New Language				*matchit-newlang*
 							*b:match_words*
--- a/runtime/syntax/abaqus.vim
+++ b/runtime/syntax/abaqus.vim
@@ -1,6 +1,6 @@
 " Vim syntax file
 " Language:	Abaqus finite element input file (www.hks.com)
-" Maintainer:	Carl Osterwisch <osterwischc@asme.org>
+" Maintainer:	Carl Osterwisch <costerwi@gmail.com>
 " Last Change:	2002 Feb 24
 " Remark:	Huge improvement in folding performance--see filetype plugin
 
@@ -28,8 +28,7 @@ syn match abaqusBadLine	"^\s\+\*.*" disp
 hi def link abaqusComment	Comment
 hi def link abaqusKeyword	Statement
 hi def link abaqusParameter	Identifier
-hi def link abaqusValue	Constant
-hi def link abaqusBadLine    Error
-
+hi def link abaqusValue		Constant
+hi def link abaqusBadLine    	Error
 
 let b:current_syntax = "abaqus"