Update runtime files
diff --git a/runtime/compiler/icon.vim b/runtime/compiler/icon.vim
new file mode 100644
index 0000000..40f6793
--- /dev/null
+++ b/runtime/compiler/icon.vim
@@ -0,0 +1,33 @@
+" Vim compiler file
+" Compiler:	Icon Compiler
+" Maintainer:	Doug Kearns <dougkearns@gmail.com>
+" Last Change:	2022 Jun 16
+
+if exists("current_compiler")
+  finish
+endif
+let current_compiler = "icont"
+
+if exists(":CompilerSet") != 2		" older Vim always used :setlocal
+  command -nargs=* CompilerSet setlocal <args>
+endif
+
+let s:cpo_save = &cpo
+set cpo&vim
+
+CompilerSet makeprg=icont\ -s
+CompilerSet errorformat=%-G%\\d%\\+\ errors%\\=,
+		       \%ERun-time\ error\ %n,
+		       \%ERun-time\ error\ %n\ in\ %m,
+		       \%ZTraceback:,
+                       \%+Coffending\ value:\ %.%#,
+                       \%CFile\ %f;\ Line\ %l,
+                       \%EFile\ %f;\ Line\ %l\ #\ %m,
+		       \%EFile\ %f;\ %m,
+		       \%E%f:%l:\ #\ %m,
+		       \%E%f:\ %m,
+		       \%+C%.%#,
+		       \%-G%.%#
+
+let &cpo = s:cpo_save
+unlet s:cpo_save
diff --git a/runtime/doc/builtin.txt b/runtime/doc/builtin.txt
index b2e276e..455fd96 100644
--- a/runtime/doc/builtin.txt
+++ b/runtime/doc/builtin.txt
@@ -1,4 +1,4 @@
-*builtin.txt*	For Vim version 8.2.  Last change: 2022 Jun 05
+*builtin.txt*	For Vim version 8.2.  Last change: 2022 Jun 16
 
 
 		  VIM REFERENCE MANUAL	  by Bram Moolenaar
@@ -8809,6 +8809,8 @@
 			strcharpart('abc', -1, 2)
 <		results in 'a'.
 
+		Returns an empty string on error.
+
 		Can also be used as a |method|: >
 			GetText()->strcharpart(5)
 
@@ -8821,6 +8823,8 @@
 		When {skipcc} set to 1, Composing characters are ignored.
 		|strcharlen()| always does this.
 
+		Returns zero on error.
+
 		Also see |strlen()|, |strdisplaywidth()| and |strwidth()|.
 
 		{skipcc} is only available after 7.4.755.  For backward
@@ -8853,6 +8857,7 @@
 		'tabstop' and 'display'.
 		When {string} contains characters with East Asian Width Class
 		Ambiguous, this function's return value depends on 'ambiwidth'.
+		Returns zero on error.
 		Also see |strlen()|, |strwidth()| and |strchars()|.
 
 		Can also be used as a |method|: >
@@ -8886,6 +8891,7 @@
 		index.  Composing characters are considered separate
 		characters here.  Use |nr2char()| to convert the Number to a
 		String.
+		Returns -1 if {index} is invalid.
 		Also see |strcharpart()| and |strchars()|.
 
 		Can also be used as a |method|: >
@@ -8940,7 +8946,7 @@
 		The result is a Number, which is the length of the String
 		{string} in bytes.
 		If the argument is a Number it is first converted to a String.
-		For other types an error is given.
+		For other types an error is given and zero is returned.
 		If you want to count the number of multibyte characters use
 		|strchars()|.
 		Also see |len()|, |strdisplaywidth()| and |strwidth()|.
@@ -8971,6 +8977,8 @@
 		example, to get the character under the cursor: >
 			strpart(getline("."), col(".") - 1, 1, v:true)
 <
+		Returns an empty string on error.
+
 		Can also be used as a |method|: >
 			GetText()->strpart(5)
 
@@ -9033,6 +9041,8 @@
 <		This displays a newline in register a as "^@" instead of
 		starting a new line.
 
+		Returns an empty string on error.
+
 		Can also be used as a |method|: >
 			GetString()->strtrans()
 
@@ -9042,6 +9052,7 @@
 		cell, alternatively use |strdisplaywidth()|.
 		When {string} contains characters with East Asian Width Class
 		Ambiguous, this function's return value depends on 'ambiwidth'.
+		Returns zero on error.
 		Also see |strlen()|, |strdisplaywidth()| and |strchars()|.
 
 		Can also be used as a |method|: >
@@ -9067,6 +9078,8 @@
 		When substitute() is used recursively only the submatches in
 		the current (deepest) call can be obtained.
 
+		Returns an empty string or list on error.
+
 		Examples: >
 			:s/\d\+/\=submatch(0) + 1/
 			:echo substitute(text, '\d\+', '\=submatch(0) + 1', '')
@@ -9117,7 +9130,9 @@
 		|submatch()| returns.  Example: >
 		   :echo substitute(s, '%\(\x\x\)', {m -> '0x' .. m[1]}, 'g')
 
-<		Can also be used as a |method|: >
+<		Returns an empty string on error.
+
+		Can also be used as a |method|: >
 			GetString()->substitute(pat, sub, flags)
 
 swapinfo({fname})					*swapinfo()*
@@ -9172,6 +9187,8 @@
 		Warning: This function can be very slow.  Best speed is
 		obtained by going through the file in forward direction.
 
+		Returns zero on error.
+
 		Example (echoes the name of the syntax item under the cursor): >
 			:echo synIDattr(synID(line("."), col("."), 1), "name")
 <
@@ -9209,6 +9226,8 @@
 		"undercurl"	"1" if undercurled
 		"strike"	"1" if strikethrough
 
+		Returns an empty string on error.
+
 		Example (echoes the color of the syntax item under the
 		cursor): >
 	:echo synIDattr(synIDtrans(synID(line("."), col("."), 1)), "fg")
@@ -9223,6 +9242,8 @@
 		highlight the character.  Highlight links given with
 		":highlight link" are followed.
 
+		Returns zero on error.
+
 		Can also be used as a |method|: >
 	:echo synID(line("."), col("."), 1)->synIDtrans()->synIDattr("fg")
 
@@ -9267,7 +9288,7 @@
 			   echo synIDattr(id, "name")
 			endfor
 <		When the position specified with {lnum} and {col} is invalid
-		nothing is returned.  The position just after the last
+		an empty List is returned.  The position just after the last
 		character in a line and the first column in an empty line are
 		valid positions.
 
@@ -9381,6 +9402,8 @@
 				previous tab page 0 is returned.
 		The number can be used with the |:tab| command.
 
+		Returns zero on error.
+
 
 tabpagewinnr({tabarg} [, {arg}])			*tabpagewinnr()*
 		Like |winnr()| but for tab page {tabarg}.
@@ -9453,6 +9476,7 @@
 		Return the tangent of {expr}, measured in radians, as a |Float|
 		in the range [-inf, inf].
 		{expr} must evaluate to a |Float| or a |Number|.
+		Returns 0.0 if {expr} is not a |Float| or a |Number|.
 		Examples: >
 			:echo tan(10)
 <			0.648361 >
@@ -9469,6 +9493,7 @@
 		Return the hyperbolic tangent of {expr} as a |Float| in the
 		range [-1, 1].
 		{expr} must evaluate to a |Float| or a |Number|.
+		Returns 0.0 if {expr} is not a |Float| or a |Number|.
 		Examples: >
 			:echo tanh(0.5)
 <			0.462117 >
@@ -9598,6 +9623,8 @@
 				Vim becomes unusable because of all the error
 				messages.
 
+		Returns -1 on error.
+
 		Example: >
 			func MyHandler(timer)
 			  echo 'Handler called'
@@ -9633,7 +9660,7 @@
 tolower({expr})						*tolower()*
 		The result is a copy of the String given, with all uppercase
 		characters turned into lowercase (just like applying |gu| to
-		the string).
+		the string).  Returns an empty string on error.
 
 		Can also be used as a |method|: >
 			GetText()->tolower()
@@ -9641,7 +9668,7 @@
 toupper({expr})						*toupper()*
 		The result is a copy of the String given, with all lowercase
 		characters turned into uppercase (just like applying |gU| to
-		the string).
+		the string).  Returns an empty string on error.
 
 		Can also be used as a |method|: >
 			GetText()->toupper()
@@ -9654,6 +9681,8 @@
 		and so on.  Exactly like the unix "tr" command.
 		This code also deals with multibyte characters properly.
 
+		Returns an empty string on error.
+
 		Examples: >
 			echo tr("hello there", "ht", "HT")
 <		returns "Hello THere" >
@@ -9679,6 +9708,7 @@
 		When omitted both ends are trimmed.
 
 		This function deals with multibyte characters properly.
+		Returns an empty string on error.
 
 		Examples: >
 			echo trim("   some text ")
@@ -9697,6 +9727,7 @@
 		Return the largest integral value with magnitude less than or
 		equal to {expr} as a |Float| (truncate towards zero).
 		{expr} must evaluate to a |Float| or a |Number|.
+		Returns 0.0 if {expr} is not a |Float| or a |Number|.
 		Examples: >
 			echo trunc(1.456)
 <			1.0  >
@@ -9815,12 +9846,15 @@
 <		The default compare function uses the string representation of
 		each item.  For the use of {func} and {dict} see |sort()|.
 
+		Returns zero if {list} is not a |List|.
+
 		Can also be used as a |method|: >
 			mylist->uniq()
 
 values({dict})						*values()*
 		Return a |List| with all the values of {dict}.  The |List| is
 		in arbitrary order.  Also see |items()| and |keys()|.
+		Returns zero if {dict} is not a |Dict|.
 
 		Can also be used as a |method|: >
 			mydict->values()
@@ -9988,6 +10022,8 @@
 		popup window then 'buftype' is "terminal" and win_gettype()
 		returns "popup".
 
+		Return an empty string if the window cannot be found.
+
 		Can also be used as a |method|: >
 			GetWinid()->win_gettype()
 <
@@ -10025,6 +10061,8 @@
 		specified (e.g., as a consequence of maintaining
 		'winminwidth'). Returns TRUE if the window can be found and
 		FALSE otherwise.
+		This will fail for the rightmost window and a full-width
+		window, since it has no separator on the right.
 
 		Can also be used as a |method|: >
 			GetWinnr()->win_move_separator(offset)
diff --git a/runtime/doc/channel.txt b/runtime/doc/channel.txt
index 5d7e907..35a5548 100644
--- a/runtime/doc/channel.txt
+++ b/runtime/doc/channel.txt
@@ -1485,7 +1485,7 @@
     let resp = ch_sendexpr(ch, req, #{callback: 'HoverFunc'})
 
 To cancel an outstanding asynchronous LSP request sent to the server using the
-|ch_sendexpr()| function, send a cancelation message to the server using the
+|ch_sendexpr()| function, send a cancellation message to the server using the
 |ch_sendexpr()| function with the ID returned by the |ch_sendexpr()| function
 for the request.  Example: >
 
@@ -1533,7 +1533,7 @@
 	"params": <list|dict>
     }
 
-A LSP reponse message has the following format (expressed as a Vim Dict).  The
+A LSP response message has the following format (expressed as a Vim Dict).  The
 "result" and "error" fields are optional: >
 
     {
@@ -1565,7 +1565,7 @@
 	"params": <list|dict>
     }
 
-A LSP reponse message has the following format (expressed as a Vim Dict).  The
+A LSP response message has the following format (expressed as a Vim Dict).  The
 "result" and "error" fields are optional: >
 
     {
diff --git a/runtime/doc/cmdline.txt b/runtime/doc/cmdline.txt
index b2928a5..16c08b1 100644
--- a/runtime/doc/cmdline.txt
+++ b/runtime/doc/cmdline.txt
@@ -1,4 +1,4 @@
-*cmdline.txt*   For Vim version 8.2.  Last change: 2022 Apr 29
+*cmdline.txt*   For Vim version 8.2.  Last change: 2022 Jun 16
 
 
 		  VIM REFERENCE MANUAL    by Bram Moolenaar
@@ -1218,8 +1218,8 @@
 If the 'wildchar' option is set to <Tab>, and the command-line window is used
 for an Ex command, then two mappings will be added to use <Tab> for completion
 in the command-line window, like this: >
-	:imap <buffer> <Tab> <C-X><C-V>
-	:nmap <buffer> <Tab> a<C-X><C-V>
+	:inoremap <buffer> <Tab> <C-X><C-V>
+	:nnoremap <buffer> <Tab> a<C-X><C-V>
 Note that hitting <Tab> in Normal mode will do completion on the next
 character.  That way it works at the end of the line.
 If you don't want these mappings, disable them with: >
diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt
index f5f3c37..237db87 100644
--- a/runtime/doc/eval.txt
+++ b/runtime/doc/eval.txt
@@ -531,7 +531,7 @@
 Number will be converted to the String '4', leading zeros are dropped.  The
 empty string can also be used as a key.
 
-In |Vim9| script literaly keys can be used if the key consists of alphanumeric
+In |Vim9| script literally keys can be used if the key consists of alphanumeric
 characters, underscore and dash, see |vim9-literal-dict|.
 						*literal-Dict* *#{}*
 To avoid having to put quotes around every key the #{} form can be used in
@@ -1144,7 +1144,7 @@
 The "<<" and ">>" operators can be used to perform bitwise left or right shift
 of the left operand by the number of bits specified by the right operand.  The
 operands are used as positive numbers.  When shifting right with ">>" the
-topmost bit (somtimes called the sign bit) is cleared.  If the right operand
+topmost bit (sometimes called the sign bit) is cleared.  If the right operand
 (shift amount) is more than the maximum number of bits in a number
 (|v:numbersize|) the result is zero.
 
diff --git a/runtime/doc/filetype.txt b/runtime/doc/filetype.txt
index 09399f6..0ca8f38 100644
--- a/runtime/doc/filetype.txt
+++ b/runtime/doc/filetype.txt
@@ -642,15 +642,15 @@
 
 For bash,zsh,ksh or dash, add to the config file (.bashrc,.zshrc, ...)
 
-	export MANPAGER="vim -M +MANPAGER -"
+	export MANPAGER="vim +MANPAGER --not-a-term -"
 
 For (t)csh, add to the config file
 
-	setenv MANPAGER "vim -M +MANPAGER -"
+	setenv MANPAGER "vim +MANPAGER --not-a-term -"
 
 For fish, add to the config file
 
-	set -x MANPAGER "vim -M +MANPAGER -"
+	set -x MANPAGER "vim +MANPAGER --not-a-term -"
 
 
 MARKDOWN                                                *ft-markdown-plugin*
diff --git a/runtime/doc/map.txt b/runtime/doc/map.txt
index 76a2f52..bcaa374 100644
--- a/runtime/doc/map.txt
+++ b/runtime/doc/map.txt
@@ -1,4 +1,4 @@
-*map.txt*       For Vim version 8.2.  Last change: 2022 Jun 02
+*map.txt*       For Vim version 8.2.  Last change: 2022 Jun 14
 
 
 		  VIM REFERENCE MANUAL    by Bram Moolenaar
@@ -395,8 +395,14 @@
 - In Visual mode  you can use `line('v')` and `col('v')` to get one end of the
   Visual area, the cursor is at the other end.
 - In Select mode, |:map| and |:vmap| command mappings are executed in
-  Visual mode.  Use |:smap| to handle Select mode differently.
-
+  Visual mode.  Use |:smap| to handle Select mode differently.  One particular
+  edge case: >
+  	:vnoremap <C-K> <Esc>
+<  This ends Visual mode when in Visual mode, but in Select mode it does not
+  work, because Select mode is restored after executing the mapped keys.  You
+  need to use: >
+  	:snoremap <C-K> <Esc>
+<
 							*E1255* *E1136*
 <Cmd> and <ScriptCmd> commands must terminate, that is, they must be followed
 by <CR> in the {rhs} of the mapping definition.  |Command-line| mode is never
diff --git a/runtime/doc/pi_netrw.txt b/runtime/doc/pi_netrw.txt
index 08c91a8..6f96606 100644
--- a/runtime/doc/pi_netrw.txt
+++ b/runtime/doc/pi_netrw.txt
@@ -440,11 +440,11 @@
 
  *g:netrw_use_errorwindow* =2: messages from netrw will use a popup window
 			     Move the mouse and pause to remove the popup window.
-			     (default value if popup windows are availble)
+			     (default value if popup windows are available)
 			 =1 : messages from netrw will use a separate one
 			      line window.  This window provides reliable
 			      delivery of messages.
-			     (default value if popup windows are not availble)
+			     (default value if popup windows are not available)
 			 =0 : messages from netrw will use echoerr ;
 			      messages don't always seem to show up this
 			      way, but one doesn't have to quit the window.
@@ -1198,7 +1198,7 @@
 list.
 
 								*netrw-:NetrwMB*
-Addtionally, one may use :NetrwMB to bookmark files or directories. >
+Additionally, one may use :NetrwMB to bookmark files or directories. >
 
 	:NetrwMB[!] [files/directories]
 
diff --git a/runtime/doc/popup.txt b/runtime/doc/popup.txt
index 03dd3a2..84e02b9 100644
--- a/runtime/doc/popup.txt
+++ b/runtime/doc/popup.txt
@@ -1,4 +1,4 @@
-*popup.txt*  For Vim version 8.2.  Last change: 2022 Jun 06
+*popup.txt*  For Vim version 8.2.  Last change: 2022 Jun 16
 
 
 		  VIM REFERENCE MANUAL    by Bram Moolenaar
@@ -1001,8 +1001,6 @@
 
 These examples use |Vim9| script.
 
-TODO: more interesting examples
-
 					*popup_dialog-example*
 Prompt the user to press y/Y or n/N: >
 
@@ -1015,89 +1013,87 @@
 				  echomsg "'y' or 'Y' was NOT pressed"
 				endif
 			     },
+		 padding: [2, 4, 2, 4],
 		 })
 <
 					*popup_menu-shortcut-example*
 Extend popup_filter_menu() with shortcut keys: >
 
-	call popup_menu(['Save', 'Cancel', 'Discard'], #{
-		\ filter: 'MyMenuFilter',
-		\ callback: 'MyMenuHandler',
-		\ })
-
-	func MyMenuFilter(id, key)
-	  " Handle shortcuts
-	  if a:key == 'S'
-	     call popup_close(a:id, 1)
-	     return 1
-	  endif
-	  if a:key == 'C'
-	     call popup_close(a:id, 2)
-	     return 1
-	  endif
-	  if a:key == 'D'
-	     call popup_close(a:id, 3)
-	     return 1
-	  endif
-
-	  " No shortcut, pass to generic filter
-	  return popup_filter_menu(a:id, a:key)
-	endfunc
-
-	func MyMenuHandler(id, result)
-	  echo $'Result: {a:result}'
-	endfunc
+	popup_menu(['Save', 'Cancel', 'Discard'], {
+	    callback: (_, result) => {
+		echo 'dialog result is' result
+	    },
+	    filter: (id, key) => {
+		# Handle shortcuts
+		if key == 'S' || key == 's'
+		    popup_close(id, 1)
+		elseif key == 'C' || key == 'c'
+		    popup_close(id, 2)
+		elseif key == 'D' || key == 'd'
+		    popup_close(id, 3)
+		else
+		    # No shortcut, pass to generic filter
+		    return popup_filter_menu(id, key)
+		endif
+		return true
+	    },
+	})
 <
 					*popup_beval_example*
 Example for using a popup window for 'ballooneval': >
 
 	set ballooneval balloonevalterm
 	set balloonexpr=BalloonExpr()
-	let s:winid = 0
-	let s:last_text = ''
+	var winid: number
+	var last_text: string
 
-	func BalloonExpr()
-	  if s:winid && popup_getpos(s:winid) != {}
-	    " previous popup window still shows
-	    if v:beval_text == s:last_text
-	      " Still the same text, keep the existing popup
-	      return ''
+	def BalloonExpr(): string
+	    # here you would use "v:beval_text" to lookup something interesting
+	    var text = v:beval_text
+	    if winid > 0 && popup_getpos(winid) != null_dict
+		# previous popup window still shows
+		if text == last_text
+		    # still the same text, keep the existing popup
+		    return null_string
+		endif
+		popup_close(winid)
 	    endif
-	    call popup_close(s:winid)
-	  endif
-	  let s:winid = popup_beval(v:beval_text, #{mousemoved: 'word'})
-	  let s:last_text = v:beval_text
-	  return ''
-	endfunc
-<
+
+	    winid = popup_beval(text, {})
+	    last_text = text
+	    return null_string
+	enddef
+
 If the text has to be obtained asynchronously return an empty string from the
 expression function and call popup_beval() once the text is available.  In
 this example simulated with a timer callback: >
 
 	set ballooneval balloonevalterm
 	set balloonexpr=BalloonExpr()
-	let s:winid = 0
-	let s:balloonText = ''
+	var winid: number
+	var last_text: string
 
-	func BalloonExpr()
-	  if s:winid && popup_getpos(s:winid) != {}
-	    " previous popup window still shows
-	    if  v:beval_text == s:balloonText
-	      " Still the same text, keep the existing popup
-	      return ''
+	def BalloonExpr(): string
+	    var text = v:beval_text
+	    if winid > 0 && popup_getpos(winid) != null_dict
+		# previous popup window still shows
+		if text == last_text
+		    # still the same text, keep the existing popup
+		    return null_string
+		endif
+		popup_close(winid)
 	    endif
-	    call popup_close(s:winid)
-	    let s:winid = 0
-	  endif
-	  " simulate an asynchronous lookup for the text to display
-	  let s:balloonText = v:beval_text
-	  call timer_start(100, 'ShowPopup')
-	  return ''
-	endfunc
 
-	func ShowPopup(id)
-	  let s:winid = popup_beval(s:balloonText, #{mousemoved: 'word'})
-	endfunc
+	    # Simulate an asynchronous lookup that takes half a second for the
+	    # text to display.
+	    last_text = text
+	    timer_start(500, 'ShowPopup')
+	    return null_string
+	enddef
+
+	def ShowPopup(timerid: number)
+	    winid = popup_beval('Result: ' .. last_text, {})
+	enddef
 <
 
  vim:tw=78:ts=8:noet:ft=help:norl:
diff --git a/runtime/doc/todo.txt b/runtime/doc/todo.txt
index 35f48d8..7716e39 100644
--- a/runtime/doc/todo.txt
+++ b/runtime/doc/todo.txt
@@ -1,4 +1,4 @@
-*todo.txt*      For Vim version 8.2.  Last change: 2022 Jun 14
+*todo.txt*      For Vim version 8.2.  Last change: 2022 Jun 17
 
 
 		  VIM REFERENCE MANUAL	  by Bram Moolenaar
@@ -38,19 +38,15 @@
 							*known-bugs*
 -------------------- Known bugs and current work -----------------------
 
-retab test Test_retab_endless() disabled - why is interrupt not caught?
-
-searchpair() must call function to set timeout, not pass the time limit down
-(and set it many times).  #10562
-
-Add test for --gui-dialog-file, check :confirm q with change buffer.
+Searchpair() timeout using skip expression using synID() interferes with
+syntax highlighting. #10562
+Add flag that timeout is set for 'redrawtime' and only then set b_syn_slow.
 
 Prepare for Vim 9.0 release:
 - Update the user manual:
   - Add more to usr_50.txt as an "advanced section" of usr_41.txt
   - Move some from vim9.txt to the user manual?  Keep the specification.
 - Use Vim9 for more runtime files.
-- Make popup-examples use Vim9 script  Issue #10499
 - Adjust intro message to say "help version9".
 
 Further Vim9 improvements, possibly after launch:
diff --git a/runtime/doc/undo.txt b/runtime/doc/undo.txt
index 23a30af..3feac2a 100644
--- a/runtime/doc/undo.txt
+++ b/runtime/doc/undo.txt
@@ -257,7 +257,7 @@
 Undo files are normally saved in the same directory as the file.  This can be
 changed with the 'undodir' option.
 
-When the file is encrypted, the text in the undo file is also crypted.  The
+When the file is encrypted, the text in the undo file is also encrypted.  The
 same key and method is used. |encryption|
 
 Note that text properties are not stored in the undo file.  You can restore
diff --git a/runtime/doc/usr_52.txt b/runtime/doc/usr_52.txt
index 2c3e13b..41d0832 100644
--- a/runtime/doc/usr_52.txt
+++ b/runtime/doc/usr_52.txt
@@ -183,7 +183,7 @@
 That function is then in an autoload script.  We will call that one script a
 library script.
 
-The autoload mechanism is based on a funtion name that has "#" characters: >
+The autoload mechanism is based on a function name that has "#" characters: >
 
 	mylib#myfunction(arg)
 
diff --git a/runtime/doc/version5.txt b/runtime/doc/version5.txt
index d09640a..9bc43bb 100644
--- a/runtime/doc/version5.txt
+++ b/runtime/doc/version5.txt
@@ -3262,7 +3262,7 @@
 on patch from Mohsin Ahmed)
 
 When reading a file, there is an automatic detection whether it has been
-crypted.  Vim will then prompt for the key.
+encrypted.  Vim will then prompt for the key.
 
 Note that the encryption method is not compatible with Vi.  The encryption is
 not unbreakable.  This allows it to be exported from the US.
@@ -7622,7 +7622,7 @@
 Previously released patches for Vim 5.7:
 
 Patch 5.7.001
-Problem:    When the current buffer is crypted, and another modified buffer
+Problem:    When the current buffer is encrypted, and another modified buffer
 	    isn't, ":wall" will encrypt the other buffer.
 Solution:   In buf_write() use "buf" instead of "curbuf" to check for the
 	    crypt key.
diff --git a/runtime/ftplugin/icon.vim b/runtime/ftplugin/icon.vim
new file mode 100644
index 0000000..33a86df
--- /dev/null
+++ b/runtime/ftplugin/icon.vim
@@ -0,0 +1,36 @@
+" Vim filetype plugin file
+" Language:	Icon
+" Maintainer:	Doug Kearns <dougkearns@gmail.com>
+" Last Change:	2022 Jun 16
+
+if exists("b:did_ftplugin")
+  finish
+endif
+let b:did_ftplugin = 1
+
+let s:cpo_save = &cpo
+set cpo&vim
+
+setlocal comments=:#
+setlocal commentstring=#\ %s
+setlocal formatoptions-=t formatoptions+=croql
+
+let b:undo_ftplugin = "setl fo< com< cms<"
+
+if exists("loaded_matchit")
+    " let b:match_ignorecase = 0
+    let b:match_words  = '^\s*$\s*if\(def\|ndef\)\=\>:^\s*$\s*elif\>:^\s*$\s*else\>:^\s*$\s*endif\>,' .
+	  \		 '\<procedure\>:\<\%(initial\|return\|suspend\|fail\)\>:\<end\>'
+    let b:undo_ftplugin ..= " | unlet! b:match_words"
+endif
+
+if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter")
+  let b:browsefilter = "Icon Source Files (*.icn)\t*.icn\n" .
+	\	       "All Files (*.*)\t*.*\n"
+  let b:undo_ftplugin ..= " | unlet! b:browsefilter"
+endif
+
+let &cpo = s:cpo_save
+unlet s:cpo_save
+
+" vim: nowrap sw=2 sts=2 ts=8
diff --git a/runtime/indent/dtd.vim b/runtime/indent/dtd.vim
index c2b3c0c..9fca296 100644
--- a/runtime/indent/dtd.vim
+++ b/runtime/indent/dtd.vim
@@ -4,6 +4,12 @@
 " Previous Maintainer:	Nikolai Weibull <now@bitwi.se>
 " Last Change:		24 Sep 2021
 
+" Only load this indent file when no other was loaded.
+if exists("b:did_indent")
+  finish
+endif
+let b:did_indent = 1
+
 setlocal indentexpr=GetDTDIndent()
 setlocal indentkeys=!^F,o,O,>
 setlocal nosmartindent
diff --git a/runtime/indent/julia.vim b/runtime/indent/julia.vim
index a90cff4..8e4c603 100644
--- a/runtime/indent/julia.vim
+++ b/runtime/indent/julia.vim
@@ -2,9 +2,15 @@
 " Language:	Julia
 " Maintainer:	Carlo Baldassi <carlobaldassi@gmail.com>
 " Homepage:	https://github.com/JuliaEditorSupport/julia-vim
-" Last Change:	2016 jun 16
+" Last Change:	2022 Jun 14
 " Notes:        originally based on Bram Molenaar's indent file for vim
 
+" Only load this indent file when no other was loaded.
+if exists("b:did_indent")
+  finish
+endif
+let b:did_indent = 1
+
 setlocal autoindent
 
 setlocal indentexpr=GetJuliaIndent()
diff --git a/runtime/indent/perl.vim b/runtime/indent/perl.vim
index b107a72..4c91fa1 100644
--- a/runtime/indent/perl.vim
+++ b/runtime/indent/perl.vim
@@ -6,104 +6,178 @@
 " License:       Vim License (see :help license)
 " Last Change:   2021 Sep 24
 
-if exists("b:did_ftplugin") | finish | endif
-let b:did_ftplugin = 1
+" Suggestions and improvements by :
+"   Aaron J. Sherman (use syntax for hints)
+"   Artem Chuprina (play nice with folding)
 
-" Make sure the continuation lines below do not cause problems in
-" compatibility mode.
-let s:save_cpo = &cpo
+" TODO things that are not or not properly indented (yet) :
+" - Continued statements
+"     print "foo",
+"       "bar";
+"     print "foo"
+"       if bar();
+" - Multiline regular expressions (m//x)
+" (The following probably needs modifying the perl syntax file)
+" - qw() lists
+" - Heredocs with terminators that don't match \I\i*
+
+" Only load this indent file when no other was loaded.
+if exists("b:did_indent")
+    finish
+endif
+let b:did_indent = 1
+
+" Is syntax highlighting active ?
+let b:indent_use_syntax = has("syntax")
+
+setlocal indentexpr=GetPerlIndent()
+setlocal indentkeys+=0=,0),0],0=or,0=and
+if !b:indent_use_syntax
+    setlocal indentkeys+=0=EO
+endif
+
+let b:undo_indent = "setl inde< indk<"
+
+let s:cpo_save = &cpo
 set cpo-=C
 
-setlocal formatoptions-=t
-setlocal formatoptions+=crqol
-setlocal keywordprg=perldoc\ -f
+function! GetPerlIndent()
 
-setlocal comments=:#
-setlocal commentstring=#%s
+    " Get the line to be indented
+    let cline = getline(v:lnum)
 
-" Provided by Ned Konz <ned at bike-nomad dot com>
-"---------------------------------------------
-setlocal include=\\<\\(use\\\|require\\)\\>
-" '+' is removed to support plugins in Catalyst or DBIx::Class
-" where the leading plus indicates a fully-qualified module name.
-setlocal includeexpr=substitute(substitute(substitute(substitute(v:fname,'+','',''),'::','/','g'),'->\*','',''),'$','.pm','')
-setlocal define=[^A-Za-z_]
-setlocal iskeyword+=:
-
-" The following line changes a global variable but is necessary to make
-" gf and similar commands work. Thanks to Andrew Pimlott for pointing
-" out the problem.
-let s:old_isfname = &isfname
-set isfname+=:
-let s:new_isfname = &isfname
-
-augroup perl_global_options
-  au!
-  exe "au BufEnter * if &filetype == 'perl' | let &isfname = '" . s:new_isfname . "' | endif"
-  exe "au BufLeave * if &filetype == 'perl' | let &isfname = '" . s:old_isfname . "' | endif"
-augroup END
-
-" Undo the stuff we changed.
-let b:undo_ftplugin = "setlocal fo< kp< com< cms< inc< inex< def< isk<" .
-      \               " | let &isfname = '" .  s:old_isfname . "'"
-
-if get(g:, 'perl_fold', 0)
-  setlocal foldmethod=syntax
-  let b:undo_ftplugin .= " | setlocal fdm<"
-endif
-
-" Set this once, globally.
-if !exists("perlpath")
-    if executable("perl")
-      try
-	if &shellxquote != '"'
-	    let perlpath = system('perl -e "print join(q/,/,@INC)"')
-	else
-	    let perlpath = system("perl -e 'print join(q/,/,@INC)'")
-	endif
-	let perlpath = substitute(perlpath,',.$',',,','')
-      catch /E145:/
-	let perlpath = ".,,"
-      endtry
-    else
-	" If we can't call perl to get its path, just default to using the
-	" current directory and the directory of the current file.
-	let perlpath = ".,,"
+    " Indent POD markers to column 0
+    if cline =~ '^\s*=\L\@!'
+        return 0
     endif
-endif
 
-" Append perlpath to the existing path value, if it is set.  Since we don't
-" use += to do it because of the commas in perlpath, we have to handle the
-" global / local settings, too.
-if &l:path == ""
-    if &g:path == ""
-        let &l:path=perlpath
-    else
-        let &l:path=&g:path.",".perlpath
+    " Get current syntax item at the line's first char
+    let csynid = ''
+    if b:indent_use_syntax
+        let csynid = synIDattr(synID(v:lnum,1,0),"name")
     endif
-else
-    let &l:path=&l:path.",".perlpath
-endif
 
-let b:undo_ftplugin .= " | setlocal pa<"
-"---------------------------------------------
+    " Don't reindent POD and heredocs
+    if csynid == "perlPOD" || csynid == "perlHereDoc" || csynid =~ "^pod"
+        return indent(v:lnum)
+    endif
 
-" Change the browse dialog to show mainly Perl-related files
-if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter")
-    let b:browsefilter = "Perl Source Files (*.pl)\t*.pl\n" .
-		       \ "Perl Modules (*.pm)\t*.pm\n" .
-		       \ "Perl Documentation Files (*.pod)\t*.pod\n" .
-		       \ "All Files (*.*)\t*.*\n"
-    let b:undo_ftplugin .= " | unlet! b:browsefilter"
-endif
+    " Indent end-of-heredocs markers to column 0
+    if b:indent_use_syntax
+        " Assumes that an end-of-heredoc marker matches \I\i* to avoid
+        " confusion with other types of strings
+        if csynid == "perlStringStartEnd" && cline =~ '^\I\i*$'
+            return 0
+        endif
+    else
+        " Without syntax hints, assume that end-of-heredocs markers begin with EO
+        if cline =~ '^\s*EO'
+            return 0
+        endif
+    endif
 
-" Proper matching for matchit plugin
-if exists("loaded_matchit") && !exists("b:match_words")
-    let b:match_skip = 's:comment\|string\|perlQQ\|perlShellCommand\|perlHereDoc\|perlSubstitution\|perlTranslation\|perlMatch\|perlFormatField'
-    let b:match_words = '\<if\>:\<elsif\>:\<else\>'
-    let b:undo_ftplugin .= " | unlet! b:match_words b:match_skip"
-endif
+    " Now get the indent of the previous perl line.
 
-" Restore the saved compatibility options.
-let &cpo = s:save_cpo
-unlet s:save_cpo s:old_isfname s:new_isfname
+    " Find a non-blank line above the current line.
+    let lnum = prevnonblank(v:lnum - 1)
+    " Hit the start of the file, use zero indent.
+    if lnum == 0
+        return 0
+    endif
+    let line = getline(lnum)
+    let ind = indent(lnum)
+    " Skip heredocs, POD, and comments on 1st column
+    if b:indent_use_syntax
+        let skippin = 2
+        while skippin
+            let synid = synIDattr(synID(lnum,1,0),"name")
+            if (synid == "perlStringStartEnd" && line =~ '^\I\i*$')
+                        \ || (skippin != 2 && synid == "perlPOD")
+                        \ || (skippin != 2 && synid == "perlHereDoc")
+                        \ || synid == "perlComment"
+                        \ || synid =~ "^pod"
+                let lnum = prevnonblank(lnum - 1)
+                if lnum == 0
+                    return 0
+                endif
+                let line = getline(lnum)
+                let ind = indent(lnum)
+                let skippin = 1
+            else
+                let skippin = 0
+            endif
+        endwhile
+    else
+        if line =~ "^EO"
+            let lnum = search("<<[\"']\\=EO", "bW")
+            let line = getline(lnum)
+            let ind = indent(lnum)
+        endif
+    endif
+
+    " Indent blocks enclosed by {}, (), or []
+    if b:indent_use_syntax
+        " Find a real opening brace
+        " NOTE: Unlike Perl character classes, we do NOT need to escape the
+        " closing brackets with a backslash.  Doing so just puts a backslash
+        " in the character class and causes sorrow.  Instead, put the closing
+        " bracket as the first character in the class.
+        let braceclass = '[][(){}]'
+        let bracepos = match(line, braceclass, matchend(line, '^\s*[])}]'))
+        while bracepos != -1
+            let synid = synIDattr(synID(lnum, bracepos + 1, 0), "name")
+            " If the brace is highlighted in one of those groups, indent it.
+            " 'perlHereDoc' is here only to handle the case '&foo(<<EOF)'.
+            if synid == ""
+                        \ || synid == "perlMatchStartEnd"
+                        \ || synid == "perlHereDoc"
+                        \ || synid == "perlBraces"
+                        \ || synid == "perlStatementIndirObj"
+                        \ || synid =~ "^perlFiledescStatement"
+                        \ || synid =~ '^perl\(Sub\|Block\|Package\)Fold'
+                let brace = strpart(line, bracepos, 1)
+                if brace == '(' || brace == '{' || brace == '['
+                    let ind = ind + shiftwidth()
+                else
+                    let ind = ind - shiftwidth()
+                endif
+            endif
+            let bracepos = match(line, braceclass, bracepos + 1)
+        endwhile
+        let bracepos = matchend(cline, '^\s*[])}]')
+        if bracepos != -1
+            let synid = synIDattr(synID(v:lnum, bracepos, 0), "name")
+            if synid == ""
+                        \ || synid == "perlMatchStartEnd"
+                        \ || synid == "perlBraces"
+                        \ || synid == "perlStatementIndirObj"
+                        \ || synid =~ '^perl\(Sub\|Block\|Package\)Fold'
+                let ind = ind - shiftwidth()
+            endif
+        endif
+    else
+        if line =~ '[{[(]\s*\(#[^])}]*\)\=$'
+            let ind = ind + shiftwidth()
+        endif
+        if cline =~ '^\s*[])}]'
+            let ind = ind - shiftwidth()
+        endif
+    endif
+
+    " Indent lines that begin with 'or' or 'and'
+    if cline =~ '^\s*\(or\|and\)\>'
+        if line !~ '^\s*\(or\|and\)\>'
+            let ind = ind + shiftwidth()
+        endif
+    elseif line =~ '^\s*\(or\|and\)\>'
+        let ind = ind - shiftwidth()
+    endif
+
+    return ind
+
+endfunction
+
+let &cpo = s:cpo_save
+unlet s:cpo_save
+
+" vim:ts=8:sts=4:sw=4:expandtab:ft=vim
diff --git a/runtime/plugin/manpager.vim b/runtime/plugin/manpager.vim
index 6989bee..24338ca 100644
--- a/runtime/plugin/manpager.vim
+++ b/runtime/plugin/manpager.vim
@@ -1,8 +1,9 @@
 " Vim plugin for using Vim as manpager.
 " Maintainer: Enno Nagel <ennonagel+vim@gmail.com>
-" Last Change: 2022 Jun 05
+" Last Change: 2022 Jun 17
 
-command! -nargs=0 MANPAGER call s:ManPager() | delcommand MANPAGER
+" Set up the current buffer (likely read from stdin) as a manpage
+command MANPAGER call s:ManPager()
 
 function s:ManPager()
   " global options, keep these to a minimum to avoid side effects
@@ -12,11 +13,19 @@
   if exists('+viminfofile')
     set viminfofile=NONE
   endif
-  set noswapfile 
+  syntax on
 
-  setlocal ft=man
-  runtime ftplugin/man.vim
-  setlocal buftype=nofile bufhidden=hide iskeyword+=: modifiable
+  " Make this an unlisted, readonly scratch buffer
+  setlocal buftype=nofile noswapfile bufhidden=hide nobuflisted readonly
+
+  " Is this useful?  Should allow for using K on word with a colon.
+  setlocal iskeyword+=:
+
+  " Ensure text width matches window width
+  setlocal foldcolumn& nofoldenable nonumber norelativenumber
+
+  " In case Vim was invoked with -M
+  setlocal modifiable
 
   " Emulate 'col -b'
   silent! keepj keepp %s/\v(.)\b\ze\1?//ge
@@ -30,7 +39,11 @@
   if n > 1
     exe "1," . n-1 . "d"
   endif
-  setlocal nomodifiable nomodified readonly nowrite
 
-  syntax on
+  " Finished preprocessing the buffer, prevent any further modifications
+  setlocal nomodified nomodifiable
+
+  " Set filetype to man even if ftplugin is disabled
+  setlocal iskeyword+=: filetype=man
+  runtime ftplugin/man.vim
 endfunction
diff --git a/runtime/syntax/coco.vim b/runtime/syntax/coco.vim
index ae32348..dc21314 100644
--- a/runtime/syntax/coco.vim
+++ b/runtime/syntax/coco.vim
@@ -1,7 +1,7 @@
 " Vim syntax file
 " Language:     Coco/R
 " Maintainer:   Ashish Shukla <wahjava@gmail.com>
-" Last Change:  2007 Aug 10
+" Last Change:  2022 Jun 14
 " Remark:       Coco/R syntax partially implemented.
 " License:      Vim license
 
@@ -30,3 +30,4 @@
 hi def link cocoProductionCode   Statement
 hi def link cocoPragma           Special
 
+let b:current_syntax = 'coco'
diff --git a/runtime/syntax/dirpager.vim b/runtime/syntax/dirpager.vim
index 1a60063..dc8b986 100644
--- a/runtime/syntax/dirpager.vim
+++ b/runtime/syntax/dirpager.vim
@@ -6,7 +6,7 @@
 " Description:	  display directory content inside Vim with syntax
 "		  highlighting
 " File:		  runtime/syntax/dirpager.vim
-" Last Change:	  2012 May 19
+" Last Change:	  2022 Jun 14
 " Modeline:	  vim: ts=8:sw=2:sts=2:
 "
 " Credits:	  dirpager.vim is derived from Nikolai Weibulls dircolors.vim
diff --git a/runtime/syntax/dts.vim b/runtime/syntax/dts.vim
index d75b9c1..be51ab5 100644
--- a/runtime/syntax/dts.vim
+++ b/runtime/syntax/dts.vim
@@ -1,11 +1,12 @@
 " Vim syntax file
 " Language:	dts/dtsi (device tree files)
 " Maintainer:	Daniel Mack <vim@zonque.org>
-" Last Change:	2021 May 15
+" Last Change:	2022 Jun 14
 
 if exists("b:current_syntax")
   finish
 endif
+let b:current_syntax = 'dts'
 
 syntax region dtsComment        start="/\*"  end="\*/"
 syntax match  dtsReference      "&[[:alpha:][:digit:]_]\+"
diff --git a/runtime/syntax/icon.vim b/runtime/syntax/icon.vim
index 179d75c..276bb58 100644
--- a/runtime/syntax/icon.vim
+++ b/runtime/syntax/icon.vim
@@ -1,199 +1,211 @@
 " Vim syntax file
-" Language:	Icon
-" Maintainer:	Wendell Turner <wendell@adsi-m4.com>
-" URL:		ftp://ftp.halcyon.com/pub/users/wturner/icon.vim
-" Last Change:	2003 May 11
+" Language:		Icon
+" Maintainer:		Doug Kearns <dougkearns@gmail.com>
+" Previous Maintainer:	Wendell Turner <wendell@adsi-m4.com> (invalid last known address)
+" Last Change:		2022 Jun 16
+" Contributor:		eschen@alumni.princeton.edu 2002.09.18
 
-" quit when a syntax file was already loaded
+" Prelude {{{1
 if exists("b:current_syntax")
   finish
 endif
 
-syn keyword  iconFunction   abs acos any args asin atan bal
-syn keyword  iconFunction   callout center char chdir close collect copy
-syn keyword  iconFunction   cos cset delay delete detab display dtor
-syn keyword  iconFunction   entab errorclear exit exp find flush function
-syn keyword  iconFunction   get getch getche getenv iand icom image
-syn keyword  iconFunction   insert integer ior ishift ixor kbhit key
-syn keyword  iconFunction   left list loadfunc log many map match
-syn keyword  iconFunction   member move name numeric open ord pop
-syn keyword  iconFunction   pos proc pull push put read reads
-syn keyword  iconFunction   real remove rename repl reverse right rtod
-syn keyword  iconFunction   runerr save seek seq set sin sort
-syn keyword  iconFunction   sortf sqrt stop string system tab table
-syn keyword  iconFunction   tan trim type upto variable where write writes
+syn iskeyword @,48-57,_,192-255,&
 
-" Keywords
-syn match iconKeyword "&allocated"
-syn match iconKeyword "&ascii"
-syn match iconKeyword "&clock"
-syn match iconKeyword "&collections"
-syn match iconKeyword "&cset"
-syn match iconKeyword "&current"
-syn match iconKeyword "&date"
-syn match iconKeyword "&dateline"
-syn match iconKeyword "&digits"
-syn match iconKeyword "&dump"
-syn match iconKeyword "&e"
-syn match iconKeyword "&error"
-syn match iconKeyword "&errornumber"
-syn match iconKeyword "&errortext"
-syn match iconKeyword "&errorvalue"
-syn match iconKeyword "&errout"
-syn match iconKeyword "&fail"
-syn match iconKeyword "&features"
-syn match iconKeyword "&file"
-syn match iconKeyword "&host"
-syn match iconKeyword "&input"
-syn match iconKeyword "&lcase"
-syn match iconKeyword "&letters"
-syn match iconKeyword "&level"
-syn match iconKeyword "&line"
-syn match iconKeyword "&main"
-syn match iconKeyword "&null"
-syn match iconKeyword "&output"
-syn match iconKeyword "&phi"
-syn match iconKeyword "&pi"
-syn match iconKeyword "&pos"
-syn match iconKeyword "&progname"
-syn match iconKeyword "&random"
-syn match iconKeyword "&regions"
-syn match iconKeyword "&source"
-syn match iconKeyword "&storage"
-syn match iconKeyword "&subject"
-syn match iconKeyword "&time"
-syn match iconKeyword "&trace"
-syn match iconKeyword "&ucase"
-syn match iconKeyword "&version"
+" Not Top {{{1
+syn cluster iconNotTop contains=iconDocField,iconIncluded,iconStringSpecial,iconTodo,@Spell
 
-" Reserved words
-syn keyword iconReserved break by case create default do
-syn keyword iconReserved else end every fail if
-syn keyword iconReserved initial link next not of
-syn keyword iconReserved procedure repeat return suspend
-syn keyword iconReserved then to until while
-
-" Storage class reserved words
-syn keyword	iconStorageClass	global static local record
-
-syn keyword	iconTodo	contained TODO FIXME XXX BUG
-
-" String and Character constants
-" Highlight special characters (those which have a backslash) differently
-syn match iconSpecial contained "\\x\x\{2}\|\\\o\{3\}\|\\[bdeflnrtv\"\'\\]\|\\^c[a-zA-Z0-9]\|\\$"
-syn region	iconString	start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=iconSpecial
-syn region	iconCset	start=+'+ skip=+\\\\\|\\'+ end=+'+ contains=iconSpecial
-syn match	iconCharacter	"'[^\\]'"
-
-" not sure about these
-"syn match	iconSpecialCharacter "'\\[bdeflnrtv]'"
-"syn match	iconSpecialCharacter "'\\\o\{3\}'"
-"syn match	iconSpecialCharacter "'\\x\x\{2}'"
-"syn match	iconSpecialCharacter "'\\^c\[a-zA-Z0-9]'"
-
-"when wanted, highlight trailing white space
+" Whitespace errors {{{1
 if exists("icon_space_errors")
-  syn match	iconSpaceError	"\s*$"
-  syn match	iconSpaceError	" \+\t"me=e-1
+  if !exists("icon_no_trail_space_error")
+    syn match iconSpaceError "\s\+$"       display excludenl
+  endif
+  if !exists("icon_no_tab_space_error")
+    syn match iconSpaceError " \+\t"me=e-1 display
+  endif
 endif
 
-"catch errors caused by wrong parenthesis
-syn cluster	iconParenGroup contains=iconParenError,iconIncluded,iconSpecial,iconTodo,iconUserCont,iconUserLabel,iconBitField
+" Reserved words {{{1
+syn keyword iconReserved break by case create default do else every fail if
+syn keyword iconReserved initial next not of repeat return suspend then to
+syn keyword iconReserved until while
 
-syn region	iconParen	transparent start='(' end=')' contains=ALLBUT,@iconParenGroup
-syn match	iconParenError	")"
-syn match	iconInParen	contained "[{}]"
+syn keyword iconStorageClass global static local record invocable
 
+syn keyword iconLink link
 
+" Procedure definitions {{{1
+if exists("icon_no_procedure_fold")
+  syn region iconProcedure matchgroup=iconReserved start="\<procedure\>" end="\<end\>" contains=ALLBUT,@iconNotTop
+else
+  syn region iconProcedure matchgroup=iconReserved start="\<procedure\>" end="\<end\>" contains=ALLBUT,@iconNotTop fold
+endif
+
+" Keywords {{{1
+syn keyword iconKeyword &allocated &ascii &clock &collections &cset &current
+syn keyword iconKeyword &date &dateline &digits &dump &e &error &errornumber
+syn keyword iconKeyword &errortext &errorvalue &errout &fail &features &file
+syn keyword iconKeyword &host &input &lcase &letters &level &line &main &null
+syn keyword iconKeyword &output &phi &pi &pos &progname &random &regions
+syn keyword iconKeyword &source &storage &subject &time &trace &ucase &version
+
+" Graphics keywords
+syn keyword iconKeyword &col &control &interval &ldrag &lpress &lrelease
+syn keyword iconKeyword &mdrag &meta &mpress &mrelease &rdrag &resize &row
+syn keyword iconKeyword &rpress &rrelease &shift &window &x &y
+
+" Functions {{{1
+syn keyword iconFunction abs acos any args asin atan bal callout center char
+syn keyword iconFunction chdir close collect copy cos cset delay delete detab
+syn keyword iconFunction display dtor entab errorclear exit exp find flush
+syn keyword iconFunction function get getch getche getenv iand icom image
+syn keyword iconFunction insert integer ior ishift ixor kbhit key left list
+syn keyword iconFunction loadfunc log many map match member move name numeric
+syn keyword iconFunction open ord pop pos proc pull push put read reads real
+syn keyword iconFunction remove rename repl reverse right rtod runerr save
+syn keyword iconFunction seek self seq serial set sin sort sortf sqrt stop
+syn keyword iconFunction string system tab table tan trim type upto variable
+syn keyword iconFunction where write writes
+
+" Graphics functions
+syn keyword iconFunction Active Alert Bg CenterString Clip Clone Color
+syn keyword iconFunction ColorDialog ColorValue CopyArea Couple DrawArc
+syn keyword iconFunction DrawCircle DrawCurve DrawImage DrawLine DrawPoint
+syn keyword iconFunction DrawPolygon DrawRectangle DrawSegment DrawString
+syn keyword iconFunction Enqueue EraseArea Event Fg FillArc FillCircle
+syn keyword iconFunction FillPolygon FillRectangle Font FreeColor GotoRC
+syn keyword iconFunction GotoXY LeftString Lower NewColor Notice OpenDialog
+syn keyword iconFunction PaletteChars PaletteColor PaletteGrays PaletteKey
+syn keyword iconFunction Pattern Pending Pixel Raise ReadImage RightString
+syn keyword iconFunction SaveDialog SelectDialog Shade TextDialog TextWidth
+syn keyword iconFunction ToggleDialog Uncouple WAttrib WClose WDefault WDelay
+syn keyword iconFunction WDone WFlush WOpen WQuit WRead WReads WriteImage
+syn keyword iconFunction WSync WWrite WWrites
+
+" String and character constants {{{1
+syn match  iconStringSpecial "\\x\x\{2}\|\\\o\{3\}\|\\[bdeflnrtv\"\'\\]\|\\^[a-zA-Z0-9]" contained 
+syn match  iconStringSpecial "\\$"							 contained
+syn match  iconStringSpecial "_\ze\s*$"						         contained
+
+syn region iconString start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=iconStringSpecial
+syn region iconCset   start=+'+ skip=+\\\\\|\\'+ end=+'+ contains=iconStringSpecial
+
+" Bracket errors {{{1
+
+if !exists("icon_no_bracket_errors")
+  " catch errors caused by wrong brackets (ACE 2002.09.18)
+  syn cluster iconBracketGroup contains=iconBracketError,iconIncluded
+  syn region  iconBracket      start='\[' end='\]' contains=ALLBUT,@iconBracketGroup,@iconNotTop transparent 
+  syn match   iconBracketError "]"
+  
+  "catch errors caused by wrong braces (ACE 2002.09.18)
+  syn cluster iconBraceGroup contains=iconBraceError,iconIncluded
+  syn region  iconBrace	     start='{' end='}' contains=ALLBUT,@iconBraceGroup,@iconNotTop transparent 
+  syn match   iconBraceError "}"
+  
+  "catch errors caused by wrong parenthesis
+  syn cluster iconParenGroup contains=iconParenError,iconIncluded
+  syn region  iconParen	     start='(' end=')' contains=ALLBUT,@iconParenGroup,@iconNotTop transparent 
+  syn match   iconParenError ")"
+end
+
+" Numbers {{{1
 syn case ignore
 
-"integer number, or floating point number without a dot
-syn match	iconNumber		"\<\d\+\>"
+" integer
+syn match iconInteger "\<\d\+\>"
+syn match iconInteger "\<\d\{1,2}[rR][a-zA-Z0-9]\+\>"
 
-"floating point number, with dot, optional exponent
-syn match	iconFloat		"\<\d\+\.\d*\(e[-+]\=\d\+\)\=\>"
+" real with trailing dot
+syn match iconReal    "\<\d\+\."
 
-"floating point number, starting with a dot, optional exponent
-syn match	iconFloat		"\.\d\+\(e[-+]\=\d\+\)\=\>"
+" real, with dot, optional exponent
+syn match iconReal    "\<\d\+\.\d*\%(e[-+]\=\d\+\)\=\>"
 
-"floating point number, without dot, with exponent
-syn match	iconFloat		"\<\d\+e[-+]\=\d\+\>"
+" real, with leading dot, optional exponent
+syn match iconReal    "\.\d\+\%(e[-+]\=\d\+\)\=\>"
 
-"radix number
-syn match	iconRadix		"\<\d\{1,2}[rR][a-zA-Z0-9]\+\>"
+" real, without dot, with exponent
+syn match iconReal    "\<\d\+e[-+]\=\d\+\>"
 
-
-" syn match iconIdentifier	"\<[a-z_][a-z0-9_]*\>"
+syn cluster iconNumber contains=iconInteger,iconReal
 
 syn case match
 
-" Comment
-syn match	iconComment	"#.*" contains=iconTodo,iconSpaceError
+" Comments {{{1
+syn keyword iconTodo	 TODO FIXME XXX BUG contained
+syn match   iconComment	 "#.*" contains=iconTodo,iconSpaceError,@Spell
+syn match   iconDocField "^#\s\+\zs\%(File\|Subject\|Authors\=\|Date\|Version\|Links\|Requires\|See also\):" contained
 
-syn region	iconPreCondit start="^\s*$\s*\(if\>\|ifdef\>\|ifndef\>\|elif\>\|else\>\|endif\>\)" skip="\\$" end="$" contains=iconComment,iconString,iconCharacter,iconNumber,iconCommentError,iconSpaceError
+if exists("icon_no_comment_fold")
+  syn region iconDocumentation	  start="\%^#\{2,}\%(\n#\+\%(\s\+.*\)\=\)\+"   end="^#\+\n\s*$"		  contains=iconDocField keepend
+else
+  syn region iconMultilineComment start="^\s*#.*\n\%(^\s*#\)\@=" end="^\s*#.*\n\%(^\s*#\)\@!" contains=iconComment  keepend fold transparent 
+  syn region iconDocumentation	  start="\%^#\{2,}\%(\n#\)\+"	 end="^#\+\n\%([^#]\|$\)"     contains=iconDocField keepend fold
+endif
 
-syn region	iconIncluded	contained start=+"+ skip=+\\\\\|\\"+ end=+"+
-syn match	iconIncluded	contained "<[^>]*>"
-syn match	iconInclude	"^\s*$\s*include\>\s*["<]" contains=iconIncluded
-"syn match iconLineSkip	"\\$"
+" Preprocessor {{{1
+syn match iconPreInclude  '^\s*\zs$\s*include\>\ze\s*"' nextgroup=iconIncluded skipwhite
+syn match iconIncluded '"[^"]\+"' contained
 
-syn cluster	iconPreProcGroup contains=iconPreCondit,iconIncluded,iconInclude,iconDefine,iconInParen,iconUserLabel
+syn region iconPreDefine      start="^\s*\zs$\s*\%(define\|undef\)\>"			     end="$" oneline contains=ALLBUT,@iconPreGroup
+syn region iconPreProc	      start="^\s*\zs$\s*\%(error\|line\)\>"			     end="$" oneline contains=ALLBUT,@iconPreGroup
+syn region iconPreConditional start="^\s*\zs$\s*\%(if\|ifdef\|ifndef\|elif\|else\|endif\)\>" end="$" oneline contains=iconComment,iconString,iconCset,iconNumber,iconSpaceError
 
-syn region	iconDefine	start="^\s*$\s*\(define\>\|undef\>\)" skip="\\$" end="$" contains=ALLBUT,@iconPreProcGroup
+syn cluster iconPreGroup contains=iconPreCondit,iconPreInclude,iconIncluded,iconPreDefine
 
-"wt:syn region	iconPreProc "start="^\s*#\s*\(pragma\>\|line\>\|warning\>\|warn\>\|error\>\)" skip="\\$" "end="$" contains=ALLBUT,@iconPreProcGroup
+syn match   iconPreSymbol "_V\d\+"
+syn keyword iconPreSymbol _ACORN _AMIGA _ARM_FUNCTIONS _ASCII _CALLING
+syn keyword iconPreSymbol _CO_EXPRESSIONS _COMPILED _DIRECT_EXECUTION
+syn keyword iconPreSymbol _DOS_FUNCTIONS _EBCDIC _EVENT_MONITOR
+syn keyword iconPreSymbol _EXECUTABLE_IMAGES _EXTERNAL_FUNCTIONS
+syn keyword iconPreSymbol _EXTERNAL_VALUES _INTERPRETED _KEYBOARD_FUNCTIONS
+syn keyword iconPreSymbol _LARGE_INTEGERS _MACINTOSH _MEMORY_MONITOR _MSDOS
+syn keyword iconPreSymbol _MSDOS_386 _MULTIREGION _MULTITASKING _OS2 _PIPES
+syn keyword iconPreSymbol _PORT _PRESENTATION_MGR _RECORD_IO _STRING_INVOKE
+syn keyword iconPreSymbol _SYSTEM_FUNCTION _UNIX _VISUALIZATION _VMS
+syn keyword iconPreSymbol _WINDOW_FUNCTIONS _X_WINDOW_SYSTEM 
 
-" Highlight User Labels
-
-" syn cluster	iconMultiGroup contains=iconIncluded,iconSpecial,iconTodo,iconUserCont,iconUserLabel,iconBitField
-
+" Syncing {{{1
 if !exists("icon_minlines")
-  let icon_minlines = 15
+  let icon_minlines = 250
 endif
 exec "syn sync ccomment iconComment minlines=" . icon_minlines
 
-" Define the default highlighting.
+" Default Highlighting  {{{1
 
-" Only when an item doesn't have highlighting
+hi def link iconParenError	iconError
+hi def link iconBracketError	iconError
+hi def link iconBraceError	iconError
+hi def link iconSpaceError	iconError
+hi def link iconError		Error
 
-" The default methods for highlighting.  Can be overridden later
+hi def link iconInteger		Number
+hi def link iconReal		Float
+hi def link iconString		String
+hi def link iconCset		String
+hi def link iconStringSpecial	SpecialChar
 
-" hi def link iconSpecialCharacter	iconSpecial
-
-hi def link iconOctalError		iconError
-hi def link iconParenError		iconError
-hi def link iconInParen		iconError
-hi def link iconCommentError	iconError
-hi def link iconSpaceError		iconError
-hi def link iconCommentError	iconError
-hi def link iconIncluded		iconString
-hi def link iconCommentString	iconString
-hi def link iconComment2String	iconString
-hi def link iconCommentSkip	iconComment
-
-hi def link iconUserLabel		Label
-hi def link iconCharacter		Character
-hi def link iconNumber			Number
-hi def link iconRadix			Number
-hi def link iconFloat			Float
-hi def link iconInclude		Include
 hi def link iconPreProc		PreProc
-hi def link iconDefine			Macro
-hi def link iconError			Error
-hi def link iconStatement		Statement
-hi def link iconPreCondit		PreCondit
-hi def link iconString			String
-hi def link iconCset			String
-hi def link iconComment		Comment
-hi def link iconSpecial		SpecialChar
-hi def link iconTodo			Todo
+hi def link iconIncluded	iconString
+hi def link iconPreInclude	Include
+hi def link iconPreSymbol	iconPreProc
+hi def link iconPreDefine	Define
+hi def link iconPreConditional	PreCondit
+
+hi def link iconStatement	Statement
 hi def link iconStorageClass	StorageClass
-hi def link iconFunction		Statement
-hi def link iconReserved		Label
-hi def link iconKeyword		Operator
+hi def link iconFunction	Function
+hi def link iconReserved	Label
+hi def link iconLink		Include
+hi def link iconKeyword		Keyword
 
-"hi def link iconIdentifier	Identifier
+hi def link iconComment		Comment
+hi def link iconTodo		Todo
+hi def link iconDocField	SpecialComment
+hi def link iconDocumentation	Comment
 
-
+" Postscript  {{{1
 let b:current_syntax = "icon"
 
+" vim: nowrap sw=2 sts=2 ts=8 noet fdm=marker:
diff --git a/runtime/syntax/initng.vim b/runtime/syntax/initng.vim
index 5d7685c..959c79a 100644
--- a/runtime/syntax/initng.vim
+++ b/runtime/syntax/initng.vim
@@ -20,7 +20,6 @@
 syn case match
 
 let is_bash = 1
-unlet! b:current_syntax
 syn include @shTop syntax/sh.vim
 
 syn region	initngService			matchgroup=initngServiceHeader start="^\s*\(service\|virtual\|daemon\|class\|cron\)\s\+\(\(\w\|[-/*]\)\+\(\s\+:\s\+\(\w\|[-/*]\)\+\)\?\)\s\+{" end="}" contains=@initngServiceCluster
diff --git a/runtime/syntax/ipfilter.vim b/runtime/syntax/ipfilter.vim
index a7b7df2..c007626 100644
--- a/runtime/syntax/ipfilter.vim
+++ b/runtime/syntax/ipfilter.vim
@@ -1,7 +1,7 @@
 " ipfilter syntax file
 " Language: ipfilter configuration file
 " Maintainer: Hendrik Scholz <hendrik@scholz.net>
-" Last Change: 2005 Jan 27
+" Last Change: 2022 Jun 14
 "
 " http://www.wormulon.net/files/misc/ipfilter.vim
 "
@@ -52,3 +52,4 @@
 hi def link IPFAny		Statement
 hi def link IPFProto	Identifier
 
+let b:current_syntax = 'ipfilter'
diff --git a/runtime/syntax/mupad.vim b/runtime/syntax/mupad.vim
index 55ea9c4..df87ad1 100644
--- a/runtime/syntax/mupad.vim
+++ b/runtime/syntax/mupad.vim
@@ -279,5 +279,6 @@
 hi def link mupadDefine		Define
 hi def link mupadIdentifier	Identifier
 
+let b:current_syntax = 'mupad'
 
 " TODO  More comprehensive listing.
diff --git a/runtime/syntax/perl.vim b/runtime/syntax/perl.vim
index 59611b6..73f967a 100644
--- a/runtime/syntax/perl.vim
+++ b/runtime/syntax/perl.vim
@@ -4,7 +4,7 @@
 " Homepage:      https://github.com/vim-perl/vim-perl
 " Bugs/requests: https://github.com/vim-perl/vim-perl/issues
 " License:       Vim License (see :help license)
-" Last Change:   2021 Oct 7
+" Last Change:   2022 Jun 13
 " Contributors:  Andy Lester <andy@petdance.com>
 "                Hinrik Örn Sigurðsson <hinrik.sig@gmail.com>
 "                Lukas Mai <l.mai.web.de>
@@ -442,11 +442,18 @@
 " This problem also exists with empty string delimited heredocs but there's no
 " known workaround for that case.
 if get(g:, 'perl_fold', 0)
-  syntax region perlDATA matchgroup=perlDATAStart start="^__DATA__$" end="VIM_PERL_EOF\%$" contains=perlPOD,@perlDATA fold
-  syntax region perlEND  matchgroup=perlENDStart  start="^__END__$"  end="VIM_PERL_EOF\%$" contains=perlPOD,@perlDATA fold
+  syntax region perlDATA matchgroup=perlDATAStart start="^__DATA__$" end="VIM_PERL_EOF\%$" contains=@perlDATA fold
+  syntax region perlEND  matchgroup=perlENDStart  start="^__END__$"  end="VIM_PERL_EOF\%$" contains=@perlDATA fold
 else
-  syntax region perlDATA matchgroup=perlDATAStart start="^__DATA__$" end="\%$" contains=perlPOD,@perlDATA
-  syntax region perlEND  matchgroup=perlENDStart  start="^__END__$"  end="\%$" contains=perlPOD,@perlDATA
+  syntax region perlDATA matchgroup=perlDATAStart start="^__DATA__$" end="\%$" contains=@perlDATA
+  syntax region perlEND  matchgroup=perlENDStart  start="^__END__$"  end="\%$" contains=@perlDATA
+endif
+
+" TODO: generalise this to allow other filetypes
+if get(g:, 'perl_highlight_data', 0)
+  syn cluster perlDATA add=perlPOD
+else
+  syn cluster perlDATA remove=perlPOD
 endif
 
 "
diff --git a/runtime/syntax/pod.vim b/runtime/syntax/pod.vim
index 44439cb..90c9b99 100644
--- a/runtime/syntax/pod.vim
+++ b/runtime/syntax/pod.vim
@@ -5,7 +5,7 @@
 " Homepage:      https://github.com/vim-perl/vim-perl
 " Bugs/requests: https://github.com/vim-perl/vim-perl/issues
 " License:       Vim License (see :help license)
-" Last Change:   2021 Oct 8
+" Last Change:   2022 Jun 13
 
 " To add embedded POD documentation highlighting to your syntax file, add
 " the commands:
diff --git a/runtime/syntax/sendpr.vim b/runtime/syntax/sendpr.vim
index 2e07802..2541b95 100644
--- a/runtime/syntax/sendpr.vim
+++ b/runtime/syntax/sendpr.vim
@@ -1,7 +1,7 @@
 " Vim syntax file
 " Language: FreeBSD send-pr file
 " Maintainer: Hendrik Scholz <hendrik@scholz.net>
-" Last Change: 2012 Feb 03
+" Last Change: 2022 Jun 14
 "
 " http://raisdorf.net/files/misc/send-pr.vim
 
@@ -31,5 +31,7 @@
 hi def link sendprString    String
 hi def link sendprLabel     Label
 
+let b:current_syntax = 'sendpr'
+
 let &cpo = s:cpo_save
 unlet s:cpo_save
diff --git a/runtime/syntax/tar.vim b/runtime/syntax/tar.vim
index 497683a..815c221 100644
--- a/runtime/syntax/tar.vim
+++ b/runtime/syntax/tar.vim
@@ -14,4 +14,6 @@
 hi def link tarFilename	Constant
 hi def link tarDirectory Type
 
+let b:current_syntax = 'tar'
+
 " vim: ts=8
diff --git a/runtime/syntax/trustees.vim b/runtime/syntax/trustees.vim
index 6c58d39..3a7d26e 100644
--- a/runtime/syntax/trustees.vim
+++ b/runtime/syntax/trustees.vim
@@ -1,7 +1,7 @@
 " Vim syntax file
 " Language:     trustees
 " Maintainer:   Nima Talebi <nima@it.net.au>
-" Last Change:  2005-10-12
+" Last Change:  2022 Jun 14
 
 " quit when a syntax file was already loaded
 if exists("b:current_syntax")
@@ -40,3 +40,5 @@
 highlight link tfsRuleWho Identifier
 syntax match tfsRuleWhat ~[RWEBXODCU!]\+~ contained contains=tfsSpecialChar
 highlight link tfsRuleWhat Structure
+
+let b:current_syntax = 'trustees'
diff --git a/runtime/syntax/vim.vim b/runtime/syntax/vim.vim
index 1e9d6e0..4f2d949 100644
--- a/runtime/syntax/vim.vim
+++ b/runtime/syntax/vim.vim
@@ -1,8 +1,8 @@
 " Vim syntax file
 " Language:	Vim 8.2 script
 " Maintainer:	Charles E. Campbell <NcampObell@SdrPchip.AorgM-NOSPAM>
-" Last Change:	June 12, 2022
-" Version:	8.2-44
+" Last Change:	Jun 16, 20222
+" Version:	8.2-46
 " URL:	http://www.drchip.org/astronaut/vim/index.html#SYNTAX_VIM
 " Automatically generated keyword lists: {{{1
 
@@ -73,7 +73,7 @@
 syn keyword vimGroup contained	Comment Constant String Character Number Boolean Float Identifier Function Statement Conditional Repeat Label Operator Keyword Exception PreProc Include Define Macro PreCondit Type StorageClass Structure Typedef Special SpecialChar Tag Delimiter SpecialComment Debug Underlined Ignore Error Todo
 
 " Default highlighting groups {{{2
-syn keyword vimHLGroup contained	ColorColumn CurSearch Cursor CursorColumn CursorIM CursorLine CursorLineFold CursorLineNr CursorLineSign DiffAdd DiffChange DiffDelete DiffText Directory EndOfBuffer ErrorMsg FoldColumn Folded IncSearch LineNr LineNrAbove LineNrBelow MatchParen Menu ModeMsg MoreMsg NonText Normal Pmenu PmenuSbar PmenuSel PmenuThumb Question QuickFixLine Scrollbar Search SignColumn SpecialKey SpellBad SpellCap SpellLocal SpellRare StatusLine StatusLineNC StatusLineTerm TabLine TabLineFill TabLineSel Terminal Title Tooltip VertSplit Visual VisualNOS WarningMsg WildMenu
+syn keyword vimHLGroup contained	ColorColumn CurSearch Cursor CursorColumn CursorIM CursorLine CursorLineFold CursorLineNr CursorLineSign DiffAdd DiffChange DiffDelete DiffText Directory EndOfBuffer ErrorMsg FoldColumn Folded IncSearch LineNr LineNrAbove LineNrBelow MatchParen Menu ModeMsg MoreMsg NonText Normal Pmenu PmenuSbar PmenuSel PmenuThumb Question QuickFixLine Scrollbar Search SignColumn SpecialKey SpellBad SpellCap SpellLocal SpellRare StatusLine StatusLineNC StatusLineTerm StatusLineTermNC TabLine TabLineFill TabLineSel Terminal Title Tooltip VertSplit Visual VisualNOS WarningMsg WildMenu
 syn match vimHLGroup contained	"Conceal"
 syn case match
 
@@ -465,8 +465,8 @@
 " User Function Highlighting: {{{2
 " (following Gautam Iyer's suggestion)
 " ==========================
-syn match vimFunc		"\%(\%([sSgGbBwWtTlL]:\|<[sS][iI][dD]>\)\=\%(\w\+\.\)*\I[a-zA-Z0-9_.]*\)\ze\s*("		contains=vimCommand,vimFuncEcho,vimFuncName,vimUserFunc,vimExecute
-syn match vimUserFunc contained	"\%(\%([sSgGbBwWtTlL]:\|<[sS][iI][dD]>\)\=\%(\w\+\.\)*\I[a-zA-Z0-9_.]*\)\|\<\u[a-zA-Z0-9.]*\>\|\<if\>"	contains=vimCommand,vimNotation
+syn match vimFunc		"\%(\%([sSgGbBwWtTlL]:\|<[sS][iI][dD]>\)\=\%(\w\+\.\)*\I[a-zA-Z0-9_.]*\)\ze\s*("		contains=vimFuncEcho,vimFuncName,vimUserFunc,vimExecute
+syn match vimUserFunc contained	"\%(\%([sSgGbBwWtTlL]:\|<[sS][iI][dD]>\)\=\%(\w\+\.\)*\I[a-zA-Z0-9_.]*\)\|\<\u[a-zA-Z0-9.]*\>\|\<if\>"	contains=vimNotation
 syn keyword vimFuncEcho contained	ec ech echo
 
 " User Command Highlighting: {{{2