updated for version 7.0209
diff --git a/runtime/doc/Makefile b/runtime/doc/Makefile
index 1cf3241..3e77c53 100644
--- a/runtime/doc/Makefile
+++ b/runtime/doc/Makefile
@@ -71,6 +71,7 @@
 	pattern.txt \
 	pi_gzip.txt \
 	pi_netrw.txt \
+	pi_paren.txt \
 	pi_spec.txt \
 	pi_tar.txt \
 	pi_zip.txt \
@@ -196,6 +197,7 @@
 	pattern.html \
 	pi_gzip.html \
 	pi_netrw.html \
+	pi_paren.html \
 	pi_spec.html \
 	print.html \
 	quickfix.html \
diff --git a/runtime/doc/autocmd.txt b/runtime/doc/autocmd.txt
index 4899648..4dd34eb 100644
--- a/runtime/doc/autocmd.txt
+++ b/runtime/doc/autocmd.txt
@@ -1,4 +1,4 @@
-*autocmd.txt*   For Vim version 7.0aa.  Last change: 2006 Feb 20
+*autocmd.txt*   For Vim version 7.0aa.  Last change: 2006 Feb 27
 
 
 		  VIM REFERENCE MANUAL    by Bram Moolenaar
@@ -471,6 +471,8 @@
 
 							*CursorMoved*
 CursorMoved			After the cursor was moved in Normal mode.
+				Also when the text of the cursor line has been
+				changed, e.g., with "x", "rx" or "p".
 				Not triggered when there is typeahead or when
 				an operator is pending.
 				For an example see |match-parens|.
diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt
index b6534e0..a1c751d 100644
--- a/runtime/doc/eval.txt
+++ b/runtime/doc/eval.txt
@@ -1,4 +1,4 @@
-*eval.txt*      For Vim version 7.0aa.  Last change: 2006 Feb 26
+*eval.txt*      For Vim version 7.0aa.  Last change: 2006 Feb 27
 
 
 		  VIM REFERENCE MANUAL    by Bram Moolenaar
@@ -3361,12 +3361,6 @@
 		"\c" to the pattern to ignore case: >
 			:let idx = match(haystack, '\cneedle')
 <
-		When {count} is given use the {count}'th match.  When a match
-		is found in a String the search for the next one starts on
-		character further.  Thus this example results in 1: >
-			echo match("testing", "..", 0, 2)
-<		In a |List| the search continues in the next item.
-
 		If {start} is given, the search starts from byte index
 		{start} in a String or item {start} in a |List|.
 		The result, however, is still the index counted from the
@@ -3377,11 +3371,19 @@
 <		result is again "4". >
 			:echo match("testing", "t", 2)
 <		result is "3".
+		For a String, if {start} > 0 then it is like the string starts
+		{start} bytes later, thus "^" will match there.
 		For a String, if {start} < 0, it will be set to 0.  For a list
 		the index is counted from the end.
 		If {start} is out of range (> strlen({expr} for a String or
 		> len({expr} for a |List|) -1 is returned.
 
+		When {count} is given use the {count}'th match.  When a match
+		is found in a String the search for the next one starts on
+		character further.  Thus this example results in 1: >
+			echo match("testing", "..", 0, 2)
+<		In a |List| the search continues in the next item.
+
 		See |pattern| for the patterns that are accepted.
 		The 'ignorecase' option is used to set the ignore-caseness of
 		the pattern.  'smartcase' is NOT used.  The matching is always
diff --git a/runtime/doc/gui.txt b/runtime/doc/gui.txt
index de4b317..b3b0dd9 100644
--- a/runtime/doc/gui.txt
+++ b/runtime/doc/gui.txt
@@ -1,4 +1,4 @@
-*gui.txt*       For Vim version 7.0aa.  Last change: 2006 Feb 21
+*gui.txt*       For Vim version 7.0aa.  Last change: 2006 Feb 27
 
 
 		  VIM REFERENCE MANUAL    by Bram Moolenaar
@@ -24,9 +24,9 @@
 1. Starting the GUI				*gui-start* *E229* *E233*
 
 First you must make sure you actually have a version of Vim with the GUI code
-included.  You can check this with the ":version" command, it should include
-"+GUI_Athena", "+GUI_GTK", "+GUI_KDE", "+GUI_Motif" or "MS-Windows ... bit
-GUI version".
+included.  You can check this with the ":version" command, it says "with xxx
+GUI", where "xxx" is X11-Motif, X11-Athena, Photon, GTK, GTK2, etc., or
+"MS-Windows 32 bit GUI version".
 
 How to start the GUI depends on the system used.  Mostly you can run the
 GUI version of Vim with:
diff --git a/runtime/doc/help.txt b/runtime/doc/help.txt
index 42f0eb1..3192df5 100644
--- a/runtime/doc/help.txt
+++ b/runtime/doc/help.txt
@@ -1,4 +1,4 @@
-*help.txt*	For Vim version 7.0aa.  Last change: 2006 Feb 18
+*help.txt*	For Vim version 7.0aa.  Last change: 2006 Feb 27
 
 			VIM - main help file
 									 k
@@ -187,9 +187,11 @@
 |os_win32.txt|	MS-Windows 95/98/NT
 						*standard-plugin-list*
 Standard plugins ~
-|pi_netrw.txt|	Reading and writing files over a network
 |pi_gzip.txt|	Reading and writing compressed files
-|pi_expl.txt|	File explorer
+|pi_netrw.txt|	Reading and writing files over a network
+|pi_paren.txt|	Highlight matching parens
+|pi_tar.txt|	Tar file explorer
+|pi_zip.txt|	Zip archive explorer
 
 LOCAL ADDITIONS:				*local-additions*
 
diff --git a/runtime/doc/makehtml.awk b/runtime/doc/makehtml.awk
index 8ae067e..34a5544 100644
--- a/runtime/doc/makehtml.awk
+++ b/runtime/doc/makehtml.awk
@@ -581,7 +581,7 @@
 	ntags=split(atag,blata,"[ 	]");
 	if ( ntags > 1 ) { return; }
 	if 	( ( allow_one_char == "no" ) && \
-		  ( index("!#$%\&'()+,-./0:;=?@ACINX\\[\\]^_`at\\{\\}~",atag) !=0 ) ) {
+		  ( index("!#$%&'()+,-./0:;=?@ACINX\\[\\]^_`at\\{\\}~",atag) !=0 ) ) {
 		return;
 	}
 	if ( skip_word[atag] == "yes" ) { return; }
@@ -610,7 +610,7 @@
 	ntags=split(btag,blata,"[ 	]");
 	if ( ntags > 1 ) { return; }
 	if 	( ( allow_one_char == "no" ) && \
-		  ( index("!#$%\&'()+,-./0:;=?@ACINX\\[\\]^_`at\\{\\}~",btag) !=0 ) ) {
+		  ( index("!#$%&'()+,-./0:;=?@ACINX\\[\\]^_`at\\{\\}~",btag) !=0 ) ) {
 	  	return;
 	}
 	if ( skip_word[btag] == "yes" ) { return; }
diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt
index 13642e6..b17fba9 100644
--- a/runtime/doc/options.txt
+++ b/runtime/doc/options.txt
@@ -1,4 +1,4 @@
-*options.txt*	For Vim version 7.0aa.  Last change: 2006 Feb 26
+*options.txt*	For Vim version 7.0aa.  Last change: 2006 Feb 27
 
 
 		  VIM REFERENCE MANUAL	  by Bram Moolenaar
@@ -4639,7 +4639,7 @@
 			{only available when compiled with the |+linebreak|
 			feature}
 	Minimal number of columns to use for the line number.  Only relevant
-	when the 'number' option is set or printint lines with a line number.
+	when the 'number' option is set or printing lines with a line number.
 	Since one space is always between the number and the text, there is
 	one less character for the number itself.
 	The value is the minimum width.  A bigger width is used when needed to
diff --git a/runtime/doc/pi_paren.txt b/runtime/doc/pi_paren.txt
new file mode 100644
index 0000000..d1733c6
--- /dev/null
+++ b/runtime/doc/pi_paren.txt
@@ -0,0 +1,42 @@
+*pi_paren.txt*   For Vim version 7.0aa.  Last change: 2006 Feb 27
+
+
+		  VIM REFERENCE MANUAL    by Bram Moolenaar
+
+
+Highlighting matching parens			*matchparen*
+
+The functionality mentioned here is a |standard-plugin|.
+This plugin is only available if 'compatible' is not set.
+
+You can avoid loading this plugin by setting the "loaded_matchparen" variable: >
+	:let loaded_matchparen = 1
+
+The plugin installs CursorMoved autocommands to redefine the match
+highlighting.
+
+To disable the plugin after it was loaded use this command: >
+
+	:NoMatchParen
+
+And to enable it again: >
+
+	:DoMatchParen
+
+The highlighting used is ParenMatch.  You can specify different colors with
+the ":highlight" command.  Example: >
+
+	:hi ParenMatch ctermbg=blue guibg=lightblue
+
+The characters to be matched come from the 'matchpairs' option.  You can
+change the value to highlight different matches.  Note that not everything is
+possible.  For example, you can't highlight single or double quotes, because
+the start and end are equal.
+
+The syntax highlighting attributes are used.  When the cursor currently is not
+in a string or comment syntax item, then matches inside string and comment
+syntax items are ignored.  Any syntax items with "string" or "comment"
+somewhere in their name are considered string or comment items.
+
+==============================================================================
+ vim:tw=78:ts=8:ft=help:norl:
diff --git a/runtime/doc/tags b/runtime/doc/tags
index 0a5d062..3da16a4 100644
--- a/runtime/doc/tags
+++ b/runtime/doc/tags
@@ -5920,6 +5920,7 @@
 matchend()	eval.txt	/*matchend()*
 matchit-install	usr_05.txt	/*matchit-install*
 matchlist()	eval.txt	/*matchlist()*
+matchparen	pi_paren.txt	/*matchparen*
 matchstr()	eval.txt	/*matchstr()*
 max()	eval.txt	/*max()*
 mbyte-IME	mbyte.txt	/*mbyte-IME*
@@ -6180,6 +6181,7 @@
 new-line-continuation	version5.txt	/*new-line-continuation*
 new-location-list	version7.txt	/*new-location-list*
 new-manpage-trans	version7.txt	/*new-manpage-trans*
+new-matchparen	version7.txt	/*new-matchparen*
 new-multi-byte	version5.txt	/*new-multi-byte*
 new-multi-lang	version6.txt	/*new-multi-lang*
 new-netrw-explore	version7.txt	/*new-netrw-explore*
@@ -6318,6 +6320,7 @@
 phtml.vim	syntax.txt	/*phtml.vim*
 pi_gzip.txt	pi_gzip.txt	/*pi_gzip.txt*
 pi_netrw.txt	pi_netrw.txt	/*pi_netrw.txt*
+pi_paren.txt	pi_paren.txt	/*pi_paren.txt*
 pi_spec.txt	pi_spec.txt	/*pi_spec.txt*
 plugin	usr_05.txt	/*plugin*
 plugin-details	filetype.txt	/*plugin-details*
diff --git a/runtime/doc/todo.txt b/runtime/doc/todo.txt
index 00aa9b1..efee16c 100644
--- a/runtime/doc/todo.txt
+++ b/runtime/doc/todo.txt
@@ -1,4 +1,4 @@
-*todo.txt*      For Vim version 7.0aa.  Last change: 2006 Feb 26
+*todo.txt*      For Vim version 7.0aa.  Last change: 2006 Feb 27
 
 
 		  VIM REFERENCE MANUAL	  by Bram Moolenaar
@@ -30,11 +30,8 @@
 							*known-bugs*
 -------------------- Known bugs and current work -----------------------
 
-Script ID is only remembered for global options. Should remember it for every
-local option separately.
-    Change PV_XXX values in separate ranges for buffer and window.
-    Move the enums to option.h so that the size is known in structs.h
-    use array for each window and buffer with scriptID values.
+test 49 fails because of the function line numbering now taking care of
+continuation lines.
 
 Crash with X command server (Ciaran McCreesh).
 
@@ -43,7 +40,6 @@
 
 "fsutil hardlink" can create a hard link on an NTFS file system. (Daniel
 Einspanjer)  What library function can detect that?
-
 Win32: use GetFileInformationByHandle() to detect hard links on NTFS?
 (George Reilly)
 
@@ -90,9 +86,6 @@
   adding a bad word like "zw" would.  Use "zuw" to undo "zw"?  (Antonio
   Colombo)
 
-An error in a function uses a line number that doesn't take line continuation
-into account. (Mikolaj Machowski)  Store line count in an extra array?
-
 Is it possible to keep the command-line window open?  Would actually work like
 closing it, executing the command and re-opening it (at the same position).
 
@@ -1603,7 +1596,7 @@
     "%" match.  :syntax nomatch cMatchError (,{,[,),},] [contained]
 8   Highlight the text between two matching parens (e.g., with a grey
     background) when on one of the parens or in between them.
-    Or highlight the matching paren when the cursor is on one.
+    Option for the matchparen plugin?
 8   Add a command to jump to the next character highlighted with "Error".
 8   When using a cterm, and no ctermfg or ctermbg are defined, use start/stop
     sequences.	Add remark in docs that :if 'term' == "term-name" should be
@@ -1796,17 +1789,16 @@
     specified in any way?  To be able to jump to the last edited file.
 8   Pass the executable name to the Vim scripts in some way.  As v:argv0?
 8   Add command arguments with three dashes, passed on to Vim scripts.
-8   When starting to source a vim script, delete all functions that it has
-    previously defined?  Avoids using ":fun!" all the time.
 7   Add optional arguments to user functions:
 	:func myFunc(arg1, arg2, arg3 = "blah", arg4 = 17)
 6   User functions: Functions local to buffer "b:func()"?
-8   Add ":let var[{expr}] = {expr}".  When past the end of "var" just ignore.
+8   For Strings add ":let var[{expr}] = {expr}".  When past the end of "var"
+    just ignore.
 8   The "= register should be writable, if followed by the name of a variable,
     option or environment variable.
 8   ":let &option" should list the value of the option.
-7   Add synIDlist(), making the whole list of syntax items on the
-    stack available (separated with '\n').
+7   Add synIDlist(), making the whole list of syntax items on the syntax stack
+    available as a List.
 8   Add autocommand-event for when a variable is changed:
 	:au VarChanged {varname} {commands}
 8   Add "has("gui_capable")", to check if the GUI can be started.
diff --git a/runtime/doc/version7.txt b/runtime/doc/version7.txt
index 29e8afc..065cfaa 100644
--- a/runtime/doc/version7.txt
+++ b/runtime/doc/version7.txt
@@ -1,4 +1,4 @@
-*version7.txt*  For Vim version 7.0aa.  Last change: 2006 Feb 26
+*version7.txt*  For Vim version 7.0aa.  Last change: 2006 Feb 27
 
 
 		  VIM REFERENCE MANUAL    by Bram Moolenaar
@@ -23,6 +23,7 @@
 Omni completion				|new-omni-completion|
 MzScheme interface			|new-MzScheme|
 Printing multi-byte text		|new-print-multi-byte|
+Highlighting matching parens		|new-matchparen|
 Translated manual pages			|new-manpage-trans|
 Internal grep				|new-vimgrep|
 Scroll back in messages			|new-scroll-back|
@@ -227,6 +228,16 @@
 Also see |postscript-cjk-printing|.  (Mike Williams)
 
 
+Highlighting matching parens				*new-matchparen*
+----------------------------
+
+When moving the cursor through the text and it is on a paren, then the
+matching paren can be highlighted.  This uses the new |CursorMoved|
+autocommand event.
+
+See |pi_paren.txt| for more information.
+
+
 Translated manual pages					*new-manpage-trans*
 -----------------------
 
@@ -1767,4 +1778,17 @@
 
 "dip" in trailing empty lines left one empty line behind.
 
+The script ID was only remembered globally for each option. When a buffer- or
+window-local option was set the same "last set" location was changed for all
+buffers and windows.  Now remember the script ID for each local option
+separately.
+
+GUI: The "Replace All" button didn't handle backslashes in the replacement in
+the same way as "Replace".  Escape backslashes so that they are taken
+literally.
+
+An error in a function reported a line number that doesn't take line
+continuation into account.  Now store a NULL for continuation lines, so that
+the index is equal to the line number in the sourced file.
+
  vim:tw=78:ts=8:ft=help:norl:
diff --git a/runtime/filetype.vim b/runtime/filetype.vim
index 2a3cc2a..c25ab53 100644
--- a/runtime/filetype.vim
+++ b/runtime/filetype.vim
@@ -1,7 +1,7 @@
 " Vim support file to detect file types
 "
 " Maintainer:	Bram Moolenaar <Bram@vim.org>
-" Last Change:	2006 Feb 25
+" Last Change:	2006 Feb 27
 
 " Listen very carefully, I will say this only once
 if exists("did_load_filetypes")
@@ -1658,19 +1658,29 @@
 au BufNewFile,BufRead *.tex			call s:FTtex()
 
 fun! s:FTtex()
-  let n = 1
-  while n < 10 && n < line("$")
-    let line = getline(n)
-    if line =~ '^\s*\\\%(documentclass\>\|usepackage\>\|begin{\)'
-      setf tex
-      return
-    elseif line =~ '^\s*\\\%(start\l\+\|setup\l\+\|usemodule\|enablemode\>\|enableregime\>\|setvariables\>\|useencoding\>\|usesymbols\>\|stel\l\+\|verwende\l\+\|stel\l\+\|gebruik\l\+\|usa\l\+\|imposta\l\+\|regle\l\+\|utilisemodule\>\)\>'
-      setf context
-      return
+  let lnum = 1
+  let checked = 0
+  while checked < 25 && lnum < line("$")
+    let line = getline(lnum)
+    if line !~ '^\s*%'
+      if line =~ '^\s*\\\%(documentclass\>\|usepackage\>\|begin{\|newcommand\>\|renewcommand\>\)'
+	setf tex
+	return
+      elseif line =~ '^\s*\\\%(start\a\+\|setup\a\+\|usemodule\|enablemode\|enableregime\|setvariables\|useencoding\|usesymbols\|stelle\a\+\|verwende\a\+\|stel\a\+\|gebruik\a\+\|usa\a\+\|imposta\a\+\|regle\a\+\|utilisemodule\)\>'
+	setf context
+	return
+      endif
+      let checked = checked + 1
     endif
-    let n = n + 1
+    let lnum = lnum + 1
   endwhile
-  setf tex
+
+  " Didn't recognize anything, guess.
+  if exists("g:tex_flavour") && g:tex_flavour == "context"
+    setf context
+  else
+    setf tex
+  endif
 endfun
 
 " Context
diff --git a/runtime/plugin/matchparen.vim b/runtime/plugin/matchparen.vim
new file mode 100644
index 0000000..c11ca9f
--- /dev/null
+++ b/runtime/plugin/matchparen.vim
@@ -0,0 +1,106 @@
+" Vim plugin for showing matching parens
+" Maintainer:  Bram Moolenaar <Bram@vim.org>
+" Last Change: 2006 Feb 27
+
+" Exit quickly when:
+" - this plugin was already loaded (or disabled)
+" - when 'compatible' is set
+" - the "CursorMoved" autocmd event is not availble.
+if exists("g:loaded_matchparen") || &cp || !exists("##CursorMoved")
+  finish
+endif
+let g:loaded_matchparen = 1
+
+augroup matchparen
+  " Replace all matchparen autocommands
+  autocmd! CursorMoved,CursorMovedI * call s:Highlight_Matching_Pair()
+augroup END
+
+let s:paren_hl_on = 0
+
+" Skip the rest if it was already done.
+if exists("*s:Highlight_Matching_Pair")
+  finish
+endif
+
+" The function that is invoked (very often) to define a ":match" highlighting
+" for any matching paren.
+function! s:Highlight_Matching_Pair()
+  " Remove any previous match.
+  if s:paren_hl_on
+    match none
+    let s:paren_hl_on = 0
+  endif
+
+  " Get the character under the cursor and check if it's in 'matchpairs'.
+  let c_lnum = line('.')
+  let c_col = col('.')
+  let before = 0
+
+  let c = getline(c_lnum)[c_col - 1]
+  let plist = split(&matchpairs, ':\|,')
+  let i = index(plist, c)
+  if i < 0
+    " not found, in Insert mode try character before the cursor
+    if c_col > 1 && (mode() == 'i' || mode() == 'R')
+      let before = 1
+      let c = getline(c_lnum)[c_col - 2]
+      let i = index(plist, c)
+    endif
+    if i < 0
+      " not found, nothing to do
+      return
+    endif
+  endif
+
+  " Figure out the arguments for searchpairpos().
+  " Restrict the search to visible lines with "stopline".
+  if i % 2 == 0
+    let s_flags = 'nW'
+    let c2 = plist[i + 1]
+    let stopline = line('w$')
+  else
+    let s_flags = 'nbW'
+    let c2 = c
+    let c = plist[i - 1]
+    let stopline = line('w0')
+  endif
+  if c == '['
+    let c = '\['
+    let c2 = '\]'
+  endif
+
+  " When not in a string or comment ignore matches inside them.
+  let s_skip ='synIDattr(synID(c_lnum, c_col - before, 0), "name") ' .
+	\ '=~?  "string\\|comment"'
+  execute 'if' s_skip '| let s_skip = 0 | endif'
+
+  " Find the match.  When it was just before the cursor move it there for a
+  " moment.  To restore the cursor position use "N|" and when 'virtualedit'
+  " is set, cursor() otherwise.
+  if before > 0
+    if &ve != ''
+      let vcol = virtcol('.')
+    endif
+    call cursor(c_lnum, c_col - before)
+  endif
+  let [m_lnum, m_col] = searchpairpos(c, '', c2, s_flags, s_skip, stopline)
+  if before > 0
+    if &ve != ''
+      exe 'normal ' . vcol . '|'
+    else
+      call cursor(0, c_col)
+    endif
+  endif
+
+  " If a match is found setup match highlighting.
+  if m_lnum > 0 && m_lnum >= line('w0') && m_lnum <= line('w$')
+    exe 'match MatchParen /\(\%' . c_lnum . 'l\%' . (c_col - before) .
+	  \ 'c\)\|\(\%' . m_lnum . 'l\%' . m_col . 'c\)/'
+    let s:paren_hl_on = 1
+  endif
+endfunction
+
+" Define commands that will disable and enable the plugin.
+command! NoMatchParen match none | unlet! g:loaded_matchparen | au! matchparen
+command! DoMatchParen runtime plugin/matchparen.vim | doau CursorMoved