changeset 40:f1d2a58883b9 v7.0024

updated for version 7.0024
author vimboss
date Fri, 24 Dec 2004 14:35:23 +0000
parents 410fa1a31baf
children f529edb9bab3
files Filelist runtime/doc/autocmd.txt runtime/doc/cmdline.txt runtime/doc/index.txt runtime/doc/insert.txt runtime/doc/options.txt runtime/doc/russian.txt runtime/doc/tags runtime/doc/todo.txt runtime/doc/various.txt runtime/doc/version7.txt runtime/doc/vimdi-it.1 runtime/doc/vimdiff-it.1 runtime/doc/vimtu-it.1 runtime/doc/vimtutor-it.1 runtime/doc/windows.txt runtime/optwin.vim src/Makefile src/buffer.c src/charset.c src/ex_cmds.c src/ex_cmds.h src/ex_cmds2.c src/ex_docmd.c src/fileio.c src/gui_gtk.c src/installman.sh src/installml.sh src/main.c src/normal.c src/option.c src/option.h src/proto/ex_cmds.pro src/proto/fileio.pro src/screen.c src/structs.h src/tag.c src/testdir/Make_amiga.mak src/testdir/Make_dos.mak src/testdir/Make_os2.mak src/testdir/Make_vms.mms src/testdir/Makefile src/testdir/test54.in src/testdir/test54.ok src/version.h
diffstat 45 files changed, 991 insertions(+), 415 deletions(-) [+]
line wrap: on
line diff
--- a/Filelist
+++ b/Filelist
@@ -159,6 +159,8 @@ SRC_UNIX =	\
 		src/integration.c \
 		src/integration.h \
 		src/link.sh \
+		src/installman.sh \
+		src/installml.sh \
 		src/mkinstalldirs \
 		src/os_unix.c \
 		src/os_unix.h \
@@ -449,7 +451,6 @@ RT_ALL =	\
 		runtime/doc/vimdiff.1 \
 		runtime/doc/vimtutor.1 \
 		runtime/doc/xxd.1 \
-		runtime/doc/*-it.1 \
 		runtime/ftoff.vim \
 		runtime/gvimrc_example.vim \
 		runtime/macros/README.txt \
@@ -660,6 +661,7 @@ EXTRA =		\
 # generic language files
 LANG_GEN = \
 		README_lang.txt \
+		runtime/doc/*-it.1 \
 		runtime/lang/README.txt \
 		runtime/lang/menu_*.vim \
 		runtime/keymap/README.txt \
--- a/runtime/doc/autocmd.txt
+++ b/runtime/doc/autocmd.txt
@@ -1,4 +1,4 @@
-*autocmd.txt*   For Vim version 7.0aa.  Last change: 2004 Dec 16
+*autocmd.txt*   For Vim version 7.0aa.  Last change: 2004 Dec 24
 
 
 		  VIM REFERENCE MANUAL    by Bram Moolenaar
@@ -14,9 +14,10 @@ 3.  Removing autocommands	|autocmd-remov
 4.  Listing autocommands	|autocmd-list|
 5.  Events			|autocmd-events|
 6.  Patterns			|autocmd-patterns|
-7.  Groups			|autocmd-groups|
-8.  Executing autocommands	|autocmd-execute|
-9.  Using autocommands		|autocmd-use|
+7.  Buffer-local autocommands	|autocmd-buflocal|
+8.  Groups			|autocmd-groups|
+9.  Executing autocommands	|autocmd-execute|
+10. Using autocommands		|autocmd-use|
 
 {Vi does not have any of these commands}
 {only when the |+autocmd| feature has not been disabled at compile time}
@@ -62,6 +63,9 @@ Note: The ":autocmd" command cannot be f
 			order in which they were given.  See |autocmd-nested|
 			for [nested].
 
+The special pattern <buffer> or <buffer=N> defines a buffer-local autocommand.
+See |autocmd-buflocal|.
+
 Note that special characters (e.g., "%", "<cword>") in the ":autocmd"
 arguments are not expanded when the autocommand is defined.  These will be
 expanded when the Event is recognized, and the {cmd} is executed.  The only
@@ -148,6 +152,9 @@ If you provide the [group] argument, Vim
 [group]; otherwise, Vim lists the autocommands for ALL groups.  Note that this
 argument behavior differs from that for defining and removing autocommands.
 
+In order to list buffer-local autocommands, use a pattern in the form <buffer>
+or <buffer=N>.  See |autocmd-buflocal|.
+
 ==============================================================================
 5. Events					*autocmd-events* *E215* *E216*
 
@@ -553,6 +560,10 @@ 2. When there is a '/' in the pattern,  
    both short file name (as you typed it) and the full file name (after
    expanding it to a full path and resolving symbolic links).
 
+The special pattern <buffer> or <buffer=N> is used for buffer-local
+autocommands |autocmd-buflocal|.  This pattern is not matched against the name
+of a buffer.
+
 Examples: >
 	:autocmd BufRead *.txt		set et
 Set the 'et' option for all text files. >
@@ -608,7 +619,7 @@ Note that for all systems the '/' charac
 MS-DOS and OS/2).  This was done because the backslash is difficult to use
 in a pattern and to make the autocommands portable across different systems.
 
-
+							*autocmd-changes*
 Matching with the pattern is done when an event is triggered.  Changing the
 buffer name in one of the autocommands, or even deleting the buffer, does not
 change which autocommands will be executed.  Example: >
@@ -621,8 +632,62 @@ the current buffer instead.  Vim doesn't
 doesn't match with that buffer name.  It matches "*.foo" with the name of the
 buffer at the moment the event was triggered.
 
+However, buffer-local autocommands will not be executed for a buffer that has
+been wiped out with |:bwipe|.  After deleting the buffer with |:bdel| the
+buffer actually still exists (it becomes unlisted), thus the autocommands are
+still executed.
+
 ==============================================================================
-7. Groups						*autocmd-groups*
+7. Buffer-local autocommands  	*autocmd-buflocal* *autocmd-buffer-local*
+                                    	*<buffer=N>* *<buffer=abuf>* *E680*
+
+Buffer-local autocommands are attached to a specific buffer.  They are useful
+if the buffer does not have a name and when the name does not match a specific
+pattern.  But it also means they must be explicitly added to each buffer.
+
+Instead of a pattern buffer-local autocommands use one of these forms:
+	<buffer>	current buffer
+	<buffer=99>	buffer number 99
+	<buffer=abuf>	using <abuf> (only when executing autocommands)
+			|<abuf>|
+
+Examples: >
+    :au CursorHold <buffer>  echo 'hold'
+    :au CursorHold <buffer=33>  echo 'hold'
+    :au CursorHold <buffer=abuf>  echo 'hold'
+
+All the commands for autocommands also work with buffer-local autocommands,
+simply use the special string instead of the pattern.  Examples: >
+    :au! * <buffer>     	     " remove buffer-local autotommands for
+                                     " current buffer
+    :au! * <buffer=33>  	     " remove buffer-local autotommands for
+    				     " buffer #33
+    :dobuf :au! CursorHold <buffer>  " remove autocmd for given event for all
+    				     " buffers
+    :au * <buffer>       	     " list buffer-local autocommands for
+    				     " current buffer
+
+Note that when an autocommand is defined for the current buffer, it is stored
+with the buffer number.  Thus it uses the form "<buffer=12>", where 12 is the
+number of the current buffer.  You will see this when listing autocommands,
+for example.
+
+To test for presence of buffer-local autocommands use the |exists()| function
+as follows: >
+    :if exists("#CursorHold#<buffer=12>") | ... | endif
+    :if exists("#CursorHold#<buffer>") | ... | endif    " for current buffer
+
+When a buffer is wiped out its buffer-local autocommands are also gone, of
+course.  Note that when deleting a buffer, e.g., with ":bdel", it is only
+unlisted, the autocommands are still present.  In order to see the removal of
+buffer-local autocommands: >
+    :set verbose=6
+
+It is not possible to define buffer-local autocommands for a non-existent
+buffer.
+
+==============================================================================
+8. Groups						*autocmd-groups*
 
 Autocommands can be put together in a group.  This is useful for removing or
 executing a group of autocommands.  For example, all the autocommands for
@@ -670,7 +735,7 @@ This prevents having the autocommands de
 .vimrc file again).
 
 ==============================================================================
-8. Executing autocommands				*autocmd-execute*
+9. Executing autocommands				*autocmd-execute*
 
 Vim can also execute Autocommands non-automatically.  This is useful if you
 have changed autocommands, or when Vim has executed the wrong autocommands
@@ -713,7 +778,7 @@ option will not cause any commands to be
 			options, change highlighting, and things like that.
 
 ==============================================================================
-9. Using autocommands					*autocmd-use*
+10. Using autocommands					*autocmd-use*
 
 For WRITING FILES there are four possible sets of events.  Vim uses only one
 of these sets for a write command:
@@ -926,4 +991,5 @@ The |v:cmdbang| variable is one when "!"
 
 See the $VIMRUNTIME/plugin/netrw.vim for examples.
 
+
  vim:tw=78:ts=8:ft=help:norl:
--- a/runtime/doc/cmdline.txt
+++ b/runtime/doc/cmdline.txt
@@ -1,4 +1,4 @@
-*cmdline.txt*   For Vim version 7.0aa.  Last change: 2004 Jul 14
+*cmdline.txt*   For Vim version 7.0aa.  Last change: 2004 Dec 20
 
 
 		  VIM REFERENCE MANUAL    by Bram Moolenaar
@@ -355,6 +355,8 @@ CTRL-D		List names that match the patter
 		When showing file names, directories are highlighted (see
 		'highlight' option).  Names where 'suffixes' matches are moved
 		to the end.
+		The 'wildoptions' option can be set to "tagfile" to list the
+		file of matching tags.
 					*c_CTRL-I* *c_wildchar* *c_<Tab>*
 'wildchar' option
 		A match is done on the pattern in front of the cursor.  The
--- a/runtime/doc/index.txt
+++ b/runtime/doc/index.txt
@@ -1,4 +1,4 @@
-*index.txt*     For Vim version 7.0aa.  Last change: 2004 Nov 30
+*index.txt*     For Vim version 7.0aa.  Last change: 2004 Dec 23
 
 
 		  VIM REFERENCE MANUAL    by Bram Moolenaar
@@ -1141,6 +1141,7 @@ The commands are sorted on the non-optio
 |:ex|		:ex		same as ":edit"
 |:execute|	:exe[cute]	execute result of expressions
 |:exit|		:exi[t]		same as ":xit"
+|:exusage|	:exu[sage]	overview of Ex commands
 |:file|		:f[ile]		show or set the current file name
 |:files|	:files		list all files in the buffer list
 |:filetype|	:filet[ype]	switch file type detection on/off
@@ -1399,6 +1400,7 @@ The commands are sorted on the non-optio
 |:verbose|	:verb[ose]	execute command with 'verbose' set
 |:vertical|	:vert[ical]	make following command split vertically
 |:visual|	:vi[sual]	same as ":edit", but turns off "Ex" mode
+|:viusage|	:viu[sage]	overview of Normal mode commands
 |:view|		:vie[w]		edit a file read-only
 |:vmap|		:vm[ap]		like ":map" but for Visual mode
 |:vmapclear|	:vmapc[lear]	remove all mappings for Visual mode
--- a/runtime/doc/insert.txt
+++ b/runtime/doc/insert.txt
@@ -1,4 +1,4 @@
-*insert.txt*    For Vim version 7.0aa.  Last change: 2004 Nov 18
+*insert.txt*    For Vim version 7.0aa.  Last change: 2004 Dec 21
 
 
 		  VIM REFERENCE MANUAL    by Bram Moolenaar
--- a/runtime/doc/options.txt
+++ b/runtime/doc/options.txt
@@ -1,4 +1,4 @@
-*options.txt*	For Vim version 7.0aa.  Last change: 2004 Dec 19
+*options.txt*	For Vim version 7.0aa.  Last change: 2004 Dec 21
 
 
 		  VIM REFERENCE MANUAL	  by Bram Moolenaar
@@ -291,10 +291,11 @@ For buffer-local and window-local option
 
 Global options with a local value			*global-local*
 
-Options are global when you mostly use one value for all buffers.  For some
-global options it's useful to sometimes have a different local value.  You can
-set the local value with ":setlocal".  That buffer will then use the local
-value, while other buffers continue using the global value.
+Options are global when you mostly use one value for all buffers and windows.
+For some global options it's useful to sometimes have a different local value.
+You can set the local value with ":setlocal".  That buffer or window will then
+use the local value, while other buffers and windows continue using the global
+value.
 
 For example, you have two windows, both on C source code.  They use the global
 'makeprg' option.  If you do this in one of the two windows: >
@@ -5486,7 +5487,7 @@ A jump table for the options with a shor
 
 			   *'statusline'* *'stl'* *E540* *E541* *E542*
 'statusline' 'stl'	string	(default empty)
-			global
+			global or local to window |global-local|
 			{not in Vi}
 			{not available when compiled without the |+statusline|
 			feature}
@@ -6670,6 +6671,21 @@ A jump table for the options with a shor
 		:set wildmode=longest,list
 <	Complete longest common string, then list alternatives.
 
+						*'wildoptions'* *'wop'*
+'wildoptions' 'wop'	string	(default "")
+			global
+			{not in Vi}
+			{not available when compiled without the |+wildignore|
+			feature}
+	A list of words that change how command line completion is done.
+	Currently only one word is allowed:
+	  tagfile	When using CTRL-D to list matching tags, the kind of
+	   		tag and the file of the tag is listed.  Only one match
+			is displayed per line.  Often used tag kinds are:
+				d	#define
+				f	function
+	Also see |cmdline-completion|.
+
 						*'winaltkeys'* *'wak'*
 'winaltkeys' 'wak'	string	(default "menu")
 			global
--- a/runtime/doc/russian.txt
+++ b/runtime/doc/russian.txt
@@ -1,4 +1,4 @@
-*russian.txt*   For Vim version 7.0aa.  Last change: 2004 Jun 09
+*russian.txt*   For Vim version 7.0aa.  Last change: 2004 Dec 22
 
 
 		  VIM REFERENCE MANUAL    by Vassily Ragosin
@@ -70,14 +70,5 @@ 4. Known issues						       *russian-iss
    is related to a bug in GNU gettext library and may be fixed in the future
    releases of gettext.
 
--- When using the Win32 console version of Vim you may experience a problem
-   with many Cyrillic glyphs being replaced by whitespaces for some unknown
-   reason.  Sergey Khorev suggested a registry hack to avoid this:
-
-   REGEDIT4
-
-   [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Nls\CodePage]
-   "1252"="c_1251.nls"
-
 ===============================================================================
  vim:tw=78:ts=8:ft=help:norl:
--- a/runtime/doc/tags
+++ b/runtime/doc/tags
@@ -948,6 +948,7 @@
 'wildignore'	options.txt	/*'wildignore'*
 'wildmenu'	options.txt	/*'wildmenu'*
 'wildmode'	options.txt	/*'wildmode'*
+'wildoptions'	options.txt	/*'wildoptions'*
 'wim'	options.txt	/*'wim'*
 'winaltkeys'	options.txt	/*'winaltkeys'*
 'window'	vi_diff.txt	/*'window'*
@@ -962,6 +963,7 @@
 'wmh'	options.txt	/*'wmh'*
 'wmnu'	options.txt	/*'wmnu'*
 'wmw'	options.txt	/*'wmw'*
+'wop'	options.txt	/*'wop'*
 'wrap'	options.txt	/*'wrap'*
 'wrapmargin'	options.txt	/*'wrapmargin'*
 'wrapscan'	options.txt	/*'wrapscan'*
@@ -1892,6 +1894,8 @@ 90.5	usr_90.txt	/*90.5*
 :execute	eval.txt	/*:execute*
 :exi	editing.txt	/*:exi*
 :exit	editing.txt	/*:exit*
+:exu	various.txt	/*:exu*
+:exusage	various.txt	/*:exusage*
 :f	editing.txt	/*:f*
 :fi	editing.txt	/*:fi*
 :file	editing.txt	/*:file*
@@ -2514,6 +2518,8 @@ 90.5	usr_90.txt	/*90.5*
 :view	editing.txt	/*:view*
 :visual	editing.txt	/*:visual*
 :visual_example	visual.txt	/*:visual_example*
+:viu	various.txt	/*:viu*
+:viusage	various.txt	/*:viusage*
 :vm	map.txt	/*:vm*
 :vmap	map.txt	/*:vmap*
 :vmap_l	map.txt	/*:vmap_l*
@@ -2698,6 +2704,8 @@ 90.5	usr_90.txt	/*90.5*
 <amatch>	cmdline.txt	/*<amatch>*
 <args>	map.txt	/*<args>*
 <bang>	map.txt	/*<bang>*
+<buffer=N>	autocmd.txt	/*<buffer=N>*
+<buffer=abuf>	autocmd.txt	/*<buffer=abuf>*
 <cfile>	cmdline.txt	/*<cfile>*
 <character>	intro.txt	/*<character>*
 <count>	map.txt	/*<count>*
@@ -3550,6 +3558,7 @@ E677	eval.txt	/*E677*
 E678	pattern.txt	/*E678*
 E679	syntax.txt	/*E679*
 E68	pattern.txt	/*E68*
+E680	autocmd.txt	/*E680*
 E69	pattern.txt	/*E69*
 E70	pattern.txt	/*E70*
 E71	pattern.txt	/*E71*
@@ -3995,6 +4004,9 @@ auto-format	change.txt	/*auto-format*
 auto-setting	options.txt	/*auto-setting*
 auto-shortname	editing.txt	/*auto-shortname*
 autocmd-<>	tips.txt	/*autocmd-<>*
+autocmd-buffer-local	autocmd.txt	/*autocmd-buffer-local*
+autocmd-buflocal	autocmd.txt	/*autocmd-buflocal*
+autocmd-changes	autocmd.txt	/*autocmd-changes*
 autocmd-define	autocmd.txt	/*autocmd-define*
 autocmd-events	autocmd.txt	/*autocmd-events*
 autocmd-execute	autocmd.txt	/*autocmd-execute*
@@ -4269,6 +4281,7 @@ cp-default	version5.txt	/*cp-default*
 cpo-!	options.txt	/*cpo-!*
 cpo-$	options.txt	/*cpo-$*
 cpo-%	options.txt	/*cpo-%*
+cpo-+	options.txt	/*cpo-+*
 cpo-<	options.txt	/*cpo-<*
 cpo-A	options.txt	/*cpo-A*
 cpo-B	options.txt	/*cpo-B*
--- a/runtime/doc/todo.txt
+++ b/runtime/doc/todo.txt
@@ -1,4 +1,4 @@
-*todo.txt*      For Vim version 7.0aa.  Last change: 2004 Dec 19
+*todo.txt*      For Vim version 7.0aa.  Last change: 2004 Dec 24
 
 
 		  VIM REFERENCE MANUAL	  by Bram Moolenaar
@@ -30,10 +30,7 @@ be worked on, but only if you sponsor Vi
 							*known-bugs*
 -------------------- Known bugs and current work -----------------------
 
-Win32: Cannot edit a file starting with # with --remote. (Giuseppe Bilotta,
-Oct 6 2004)
-
-Add Makefile code to install *-it.1 manual pages in .../man/it/man1/*.1
+Patch for mch_FullName() also in Vim 6.3?  os_mswin.c
 
 Win32: "gvim -V100" should use dialog with scrollbar.  Using
 gui_mch_dialog() would be good, but need to move display_errors() to after
@@ -51,134 +48,18 @@ Included NetBeans patches (Gordon Prieur
     Asked Gordon to send the differences again, some parts apparently are
     missing.
 
-For version 7.0:
+PLANNED FOR VERSION 7.0:
 
 -   Include many PATCHES:
-    -	Patch for 'breakindent' option: repeat indent for wrapped line. (Vaclav
-	Smilauer, 2004 Sep 13, fix Oct 31)
-    7   Add 'taglistfiles' option, show file name and type when listing matching
-	tags name with CTRL-D completion.  Patch from Yegappan Lakshmanan.
-	2004 Jul 11
-    7   For Visual mode: Command to do a search for the string in the marked
-	area.  Only when fewer than two lines. Use "g/" and "gb".  Patch from
-	Yegappan Lakshmanan. 2004 Jul 11
-	When more than two lines: perform a search in the Visual area only.
-    8   Make 'statusline' local, so that each window can have a different
-	value.  But should it also be local to a buffer? (Yegappan Lakshmanan
-	has a patch, 2004 Jul 11)
-    8   Add buffer-local autocommands?  Reduces overhead for autocommands that
-	trigger often (inserting a character, switching mode).
-	    :au Event <buffer> do-something
-	E.g.:
-	    :au BufEnter <buffer> menu enable ...
-	    :au BufLeave <buffer> menu disable ...
-	Patch from Yakov Lerner, including test (2004 Jan 7).
-	VimResized	    - When the Vim window has been resized (SIGWINCH)
+    -	VimResized	    - When the Vim window has been resized (SIGWINCH)
 	  patch from Yakov Lerner, 2003 July 24.
-	Patch for specifying an expression for numbered lists. (Hugo Haas,
+    -	Patch for specifying an expression for numbered lists. (Hugo Haas,
 	2004 Aug 7)
-    --- awaiting updated patch ---
-    7   Add patch from Wall for this one ( ~/Mail/oldmail/wall/in.00019 ):
-	'flipcase' variable: upper/lowercase pairs.
-	Insert comma's between pairs and allow a range, make it look like
-	'isfname'.  E.g. ":set flipcase=a-zA-Z,xX,23-33:143-153".  The colon to
-	separate the from and to part is optional.
-	Resp: no time now.
-    8   Add GTK 2.3 file dialog support.  Patch by Grahame Bowland, 2004 Mar 15,
-	but it doesn't use "initdir" or "dflt". (will update patch)
-    8   Add ":n" to fnamemodify(): normalize path, remove "../" when possible.
-	Aric Blumer has a patch for this.
-	He will update the patch for 6.3.
-    Autocommands:
-    7   Completion of network shares, patch by Yasuhiro Matsumoto.
-	Update 2004 Sep 6.
-	How does this work?  Missing comments.
-	gettext()	Translate a message.  (Patch from Yasuhiro Matsumoto)
-			Update 2004 Sep 10
-			More docs.  Search in 'runtimepath'?
-			How to get the messages into the .po files?
-    --- did not respond (yet) --
-    7   Make "5dd" on last-but-one-line not delete anything (Vi compatible).
-	Add flag in 'cpoptions' for this.  When not present, "2dd" in the last
-	line should delete the last line.  Patch from greenx 2002 Apr 11.
-    8   Accelerators don't work in a dialog.  Include patch from Martin Dalecki
-	(Jan 3, tested by David Harrison).  Should work with Alt-o then.
-    7   Use accelerators for the Motif file selection dialog.  Patch from
-	Martin Dalecki 2002 Jan 11.
-    8   Add a few more command names to the menus.  Patch from Jiri Brezina
-	(28 feb 2002).
-    7   ATTENTION dialog choices are more logical when "Delete it' appears
-	before "Quit".  Patch by Robert Webb, 2004 May 3.
-    -   Include flipcase patch: ~/vim/patches/wall.flipcase2 ?  Make it work
-	for multi-byte characters.
-    -   Win32: add options to print dialog.  Patch from Vipin Aravind.
-    -   Patch to add highlighting for whitespace. (Tom Schumm, 2003 Jul 5)
-	use the patch that keeps using HLF_8 if HLF_WS has not
-	been given values.
-	Add section in help files for these highlight groups?
-    8   "fg" and "bg" don't work in an xterm.  Get default colors from xterm
-	with an ESC sequence.  Ideas in: ~/vim/patches/vikas.xtermcolors .
-    7   Add "DefaultFG" and "DefaultBG" for the colors of the menu. (Martin
-	Dalecki has a patch for Motif)
-    -   Add possibility to highlight specific columns (for Fortran).  Or put a
-	line in between columns (e.g. for 'textwidth').
-	Patch to add 'hlcolumn' from Vit Stradal, 2004 May 20.
-    8   Add functions:
-	confirm()		add "flags" argument, with 'v' for vertical
-				layout and 'c' for console dialog. (Haegg)
-				Flemming Madsen has a patch for the 'c' flag
-				(2003 May 13)
-	system({cmd}, {expr})	Filter {expr} through the shell command
-				{cmd} and return the result.
-				(Patch from Yegappan Lakshmanan)
-	raisewin()		raise gvim window (see HierAssist patch for
-				Tcl implementation ~/vim/HierAssist/ )
-    7   Add patch from Benoit Cerrina to integrate Vim and Perl functions
-	better.  Now also works for Ruby (2001 Nov 10)
-    -   Patch from Herculano de Lima Einloft Neto for better formatting of the
-	quickfix window (2004 dec 2)
-    7   Motif: use the menu font consistently.  Patch from Martin Dalecki 2002
-	Jan 11.
-    -   Motif: add 3D shading for the menu entries?  Patch from Martin Dalecki.
-    7   When 'rightleft' is set, the search pattern should be displayed right
-	to left as well?  See patch of Dec 26. (Nadim Shaikli)
-    8   Lock all used memory so that it doesn't get swapped to disk (uncrypted).
-	Patch by Jason Holt, 2003 May 23.
-    7   Support a stronger encryption.  Jason Holt implemented AES (May 6 2003).
-    7   Add ! register, for shell commands. (patch from Grenie)
-    8   In the gzip plugin, also recognize *.gz.orig, *.gz.bak, etc.  Like it's
-	done for filetype detection.  Patch from Walter Briscoe, 2003 Jul 1.
-    7   Add a "-@ filelist" argument: read file names from a file. (David
-	Kotchan has a patch for it)
-    8   Add term entries for function keys on xterm with alt and ctrl (new in
-	pl 94).  E.g., Control adds ";5" in "<Esc>[20;5~".  Find a generic way
-	to prepend a modifier in console mode, to avoid having to specify each
-	individual modified key.
-	Steve Wall has a patch (2002 Mar 12) for adding function keys up to 37,
-	with modifiers.
-    8   Include a connection to an external program through a pipe?  See
-	patches from Felbinger for a mathematica interface.
-	Or use emacs server kind of thing?
-    7   Add ":justify" command.  Patch from Vit Stradal 2002 Nov 25.
-    -   findmatch() should be adjusted for Lisp.  See remark at
-	get_lisp_indent().  Esp. \( and \) should be skipped. (Dorai Sitaram,
-	incomplete patch Mar 18)
-    -	Set user variables to the names of the actually used user vimrc file,
-	the first directory looked for user plugins/syntax files.
-	$MYVIMRC for .vimrc, $MYGVIMRC for .gvimrc, $MYRUNTIME/plugin for
-	runtime files?
-	Also: when the environment variable exists, use it.  If it doesn't
-	exist, set it.  Requires good names: $VIM_USER_VIMRC  $VIM_USER_DIR
     -	Add the ":cbuffer" command: read list of errors from a buffer instead
 	of from a file. (Yegappan Lakshmanan, Oct 31, but avoid the temp file)
 	Perhaps ":cexpr" could read from a list?
 	Add %b to 'errorformat': buffer number. (Yegappan Lakshmanan / Suresh
 	Govindachar)
-    -	The Replace dialog takes "\r" literal, unless "replace all" is used.
-	Need to escape backslashes.
-        Win32: the text to replace with isn't remembered.
-    -	For GUI Find/Replace dialog support using a regexp.  Patch for Motif
-	and GTK by degreneir (nov 10 and nov 18).
 -   Use a builtin grep command for ":grep"?  Makes it possible to add the
     column number.  Can use the code of ":helpgrep".
     Patch from Yegappan Lakshmanan, Nov 4.  Or use ":grep" and set 'grepprg'
@@ -324,6 +205,8 @@ 7   Make ":startinsert" command work dir
 -   Add Lua interface? (Wolfgang Oertl)
 -   "onemore" flag in 'virtualedit': move cursor past end of line.  Patch by
     Mattias Flodin (2004 Jul 30)
+-   In a :s command multi-byte characters should also be upper/lower cased
+    with \u, \U, etc.
 
 Support ":set syntax=cpp.doxygen"?  Suggested patch by Michael Geddes (9 Aug
 2004).  Should also work for 'filetype'.
@@ -353,6 +236,107 @@ profiling for Vim script?
 Mac: problem with Xcode, Vim doesn't continue until the next click.
 Apparently hangs in handle_drop().  A PostEvent() avoids it. (Da Woon Jung)
 
+Awaiting updated patches:
+    --- awaiting updated patch ---
+    7   Add patch from Wall for this one ( ~/Mail/oldmail/wall/in.00019 ):
+	'flipcase' variable: upper/lowercase pairs.
+	Insert comma's between pairs and allow a range, make it look like
+	'isfname'.  E.g. ":set flipcase=a-zA-Z,xX,23-33:143-153".  The colon to
+	separate the from and to part is optional.
+	Resp: no time now.
+    8   Add GTK 2.3 file dialog support.  Patch by Grahame Bowland, 2004 Mar
+	15, but it doesn't use "initdir" or "dflt". (will update patch)
+    8   Add ":n" to fnamemodify(): normalize path, remove "../" when possible.
+	Aric Blumer has a patch for this.
+	He will update the patch for 6.3.
+    Autocommands:
+    7   Completion of network shares, patch by Yasuhiro Matsumoto.
+	Update 2004 Sep 6.
+	How does this work?  Missing comments.
+	gettext()	Translate a message.  (Patch from Yasuhiro Matsumoto)
+			Update 2004 Sep 10
+			More docs.  Search in 'runtimepath'?
+			How to get the messages into the .po files?
+    --- did not respond (yet) --
+    -	Patch for 'breakindent' option: repeat indent for wrapped line. (Vaclav
+	Smilauer, 2004 Sep 13, fix Oct 31)
+	Asked for improvements 2004 Dec 20.
+    7   Make "5dd" on last-but-one-line not delete anything (Vi compatible).
+	Add flag in 'cpoptions' for this.  When not present, "2dd" in the last
+	line should delete the last line.  Patch from greenx 2002 Apr 11.
+    8   Accelerators don't work in a dialog.  Include patch from Martin Dalecki
+	(Jan 3, tested by David Harrison).  Should work with Alt-o then.
+    7   Use accelerators for the Motif file selection dialog.  Patch from
+	Martin Dalecki 2002 Jan 11.
+    8   Add a few more command names to the menus.  Patch from Jiri Brezina
+	(28 feb 2002).
+    7   ATTENTION dialog choices are more logical when "Delete it' appears
+	before "Quit".  Patch by Robert Webb, 2004 May 3.
+    -   Include flipcase patch: ~/vim/patches/wall.flipcase2 ?  Make it work
+	for multi-byte characters.
+    -   Win32: add options to print dialog.  Patch from Vipin Aravind.
+    -   Patch to add highlighting for whitespace. (Tom Schumm, 2003 Jul 5)
+	use the patch that keeps using HLF_8 if HLF_WS has not
+	been given values.
+	Add section in help files for these highlight groups?
+    8   "fg" and "bg" don't work in an xterm.  Get default colors from xterm
+	with an ESC sequence.  Ideas in: ~/vim/patches/vikas.xtermcolors .
+    7   Add "DefaultFG" and "DefaultBG" for the colors of the menu. (Martin
+	Dalecki has a patch for Motif)
+    -   Add possibility to highlight specific columns (for Fortran).  Or put a
+	line in between columns (e.g. for 'textwidth').
+	Patch to add 'hlcolumn' from Vit Stradal, 2004 May 20.
+    8   Add functions:
+	confirm()		add "flags" argument, with 'v' for vertical
+				layout and 'c' for console dialog. (Haegg)
+				Flemming Madsen has a patch for the 'c' flag
+				(2003 May 13)
+	system({cmd}, {expr})	Filter {expr} through the shell command
+				{cmd} and return the result.
+				(Patch from Yegappan Lakshmanan)
+	raisewin()		raise gvim window (see HierAssist patch for
+				Tcl implementation ~/vim/HierAssist/ )
+    7   Add patch from Benoit Cerrina to integrate Vim and Perl functions
+	better.  Now also works for Ruby (2001 Nov 10)
+    -   Patch from Herculano de Lima Einloft Neto for better formatting of the
+	quickfix window (2004 dec 2)
+    7   Motif: use the menu font consistently.  Patch from Martin Dalecki 2002
+	Jan 11.
+    -   Motif: add 3D shading for the menu entries?  Patch from Martin Dalecki.
+    7   When 'rightleft' is set, the search pattern should be displayed right
+	to left as well?  See patch of Dec 26. (Nadim Shaikli)
+    8   Lock all used memory so that it doesn't get swapped to disk (uncrypted).
+	Patch by Jason Holt, 2003 May 23.
+    7   Support a stronger encryption.  Jason Holt implemented AES (May 6 2003).
+    7   Add ! register, for shell commands. (patch from Grenie)
+    8   In the gzip plugin, also recognize *.gz.orig, *.gz.bak, etc.  Like it's
+	done for filetype detection.  Patch from Walter Briscoe, 2003 Jul 1.
+    7   Add a "-@ filelist" argument: read file names from a file. (David
+	Kotchan has a patch for it)
+    8   Add term entries for function keys on xterm with alt and ctrl (new in
+	pl 94).  E.g., Control adds ";5" in "<Esc>[20;5~".  Find a generic way
+	to prepend a modifier in console mode, to avoid having to specify each
+	individual modified key.
+	Steve Wall has a patch (2002 Mar 12) for adding function keys up to 37,
+	with modifiers.
+    8   Include a connection to an external program through a pipe?  See
+	patches from Felbinger for a mathematica interface.
+	Or use emacs server kind of thing?
+    7   Add ":justify" command.  Patch from Vit Stradal 2002 Nov 25.
+    -   findmatch() should be adjusted for Lisp.  See remark at
+	get_lisp_indent().  Esp. \( and \) should be skipped. (Dorai Sitaram,
+	incomplete patch Mar 18)
+    -	Set user variables to the names of the actually used user vimrc file,
+	the first directory looked for user plugins/syntax files.
+	$MYVIMRC for .vimrc, $MYGVIMRC for .gvimrc, $MYRUNTIME/plugin for
+	runtime files?
+	Also: when the environment variable exists, use it.  If it doesn't
+	exist, set it.  Requires good names: $VIM_USER_VIMRC  $VIM_USER_DIR
+    -	The Replace dialog takes "\r" literal, unless "replace all" is used.
+	Need to escape backslashes.
+        Win32: the text to replace with isn't remembered.
+    -	For GUI Find/Replace dialog support using a regexp.  Patch for Motif
+	and GTK by degreneir (nov 10 and nov 18).
 
 Vi incompatibility:
 9   In Ex mode, "u" undoes all changes, not just the last one. (John Cowan)
@@ -1267,6 +1251,7 @@ 7   Add cursor-binding: when moving the 
 Folding:
     (commands still available: zg zG zI zJ zK zp zP zq zQ zV zw zW zy zY;
     secondary: zB zS zT zZ)
+8   Add "z/" and "z?" for searching in not folded text only.
 8   Add different highlighting for a fold line depending on the fold level.
     (Noel Henson)
 8   When a closed fold is displayed open because of 'foldminlines', the
@@ -2053,9 +2038,10 @@ VMS:
 
 
 Autocommands:
-9   Make sure that side effects of autocommands are handled correctly.  Don't
-    execute autocommands when a buffer or window is halfway some changes.
-    Move all apply_autocmds() calls to a higher level where needed.
+7   For autocommand events that trigger multiple times per buffer (e.g.,
+    CursorHold), go through the list once and cache the result for a specific
+    buffer.  Invalidate the cache when adding/deleting autocommands or
+    changing the buffer name.
 8   Add ScriptReadCmd event: used to load remote Vim scripts, e.g.
     "vim -u http://mach/path/vimrc".
 8   Use another option than 'updatetime' for the CursorHold event.  The two
@@ -2626,6 +2612,8 @@ Incsearch:
 
 
 Searching:
+7   Add "g/" and "gb" to search for a pattern in the Visually selected text?
+    "g?" is already used for rot13.
 8   Add a mechanism for recursiveness: "\(([^()]*\@@[^()]*)\)\@r".  \@@ stands
     for "go recursive here" and \@r marks the recursive atom.
 7   Add an item stack to allow matching ().  One side is "push X on
--- a/runtime/doc/various.txt
+++ b/runtime/doc/various.txt
@@ -1,4 +1,4 @@
-*various.txt*   For Vim version 7.0aa.  Last change: 2004 Jul 05
+*various.txt*   For Vim version 7.0aa.  Last change: 2004 Dec 23
 
 
 		  VIM REFERENCE MANUAL    by Bram Moolenaar
@@ -595,6 +595,13 @@ 2. Online help						*online-help*
 			compresses the help files).
 			{not in Vi}
 
+							*:exu* *:exusage*
+:exu[sage]		Show help on Ex commands.  Added to simulate the Nvi
+			command. {not in Vi}
+
+							*:viu* *:viusage*
+:viu[sage]		Show help on Normal mode commands.  Added to simulate
+			the Nvi command. {not in Vi}
 
 When no argument is given to |:help| the file given with the 'helpfile' option
 will be opened.  Otherwise the specified tag is searched for in all "doc/tags"
--- a/runtime/doc/version7.txt
+++ b/runtime/doc/version7.txt
@@ -1,4 +1,4 @@
-*version7.txt*  For Vim version 7.0aa.  Last change: 2004 Dec 19
+*version7.txt*  For Vim version 7.0aa.  Last change: 2004 Dec 24
 
 
 		  VIM REFERENCE MANUAL    by Bram Moolenaar
@@ -130,6 +130,8 @@ Translated manual pages					*new-manpage
 The manual page of Vim and associated programs is now also available in
 Italian (translated by Antonio Colombo).  More languages will follow.
 
+The Unix Makefile installs the Italian manual pages in .../man/it/man1/.
+
 
 Various new items					*new-items-7*
 -----------------
@@ -153,7 +155,9 @@ Options: ~
 'printmbfont'		font names to be used for CJK output of :hardcopy
 'fsync'			Whether fsync() is called after writing a file.
 			(Ciaran McCreesh)
-
+'wildoptions'		"tagfile" value enables listing the file name of
+			matching tags for CTRL-D command line completion.
+			(based on an idea from Yegappan Lakshmanan)
 
 Ex commands: ~
 
@@ -172,6 +176,10 @@ Win32: The ":winpos" command now also wo
 
 |:sandbox|		Command modifier: execute the argument in the sandbox.
 
+|:exusage|		Help for Ex commands (Nvi command).
+
+|:viusage|		Help for Vi commands (Nvi command).
+
 
 New functions: ~
 
@@ -259,6 +267,10 @@ Added the t_SI and t_EI escape sequences
 To be used to set the cursor shape to a bar or a block.  No default values,
 they are not supported by termcap/terminfo.
 
+Autocommands can be defined local to a buffer.  This means they will also work
+when the buffer does not have a name or no specific name.  See
+|autocmd-buflocal|.  (Yakov Lerner)
+
 ==============================================================================
 IMPROVEMENTS						*improvements-7*
 
@@ -310,6 +322,9 @@ upper case.  Add color support to the bu
 For the '%' item in 'viminfo', allow a number to set a maximum for the number
 of buffers.
 
+The 'statusline' option can be local to the window, so that each window can
+have a different value.  (partly by Yegappan Lakshmanan)
+
 When a file looks like a shell script, check for an "exec" command that starts
 the tcl interpreter. (suggested by Alexios Zavras)
 
@@ -564,4 +579,7 @@ the values when recovering.
 ":bufdo g/something/p" overwrites each last printed text line with the file
 message for the next buffer.  Temporarily clear 'shortmess' to avoid that.
 
+Win32: Cannot edit a file starting with # with --remote.  Do escape % and #
+when building the ":drop" command.
+
  vim:tw=78:ts=8:ft=help:norl:
deleted file mode 100755
--- a/runtime/doc/vimdi-it.1
+++ /dev/null
@@ -1,48 +0,0 @@
-.TH VIMDIFF 1 "30 marzo 2001"
-.SH NOME
-vimdiff \- modifica due o tre versioni di un file con Vim, visualizzando le
-differenze
-.SH SINTASSI
-.br
-.B vimdiff
-[opzioni] file1 file2 [file3]
-.PP
-.B gvimdiff
-.SH DESCRIZIONE
-.B Vimdiff
-inizia
-.B Vim
-per due (o tre) file.
-Ogni file ha una sua finestra.
-Le differenze fra file sono evidenziate.
-E' una maniera elegante per controllare modifiche e portare modifiche
-verso un'altra versione dello stesso file.
-.PP
-Vedere vim(1) per dettagli su Vim in generale.
-.PP
-Se iniziato con
-.B gvimdiff
-la GUI sarà utilizzata, se disponibile.
-.PP
-In ogni finestra l'opzione 'diff' è impostata, evidenziando così le
-differenze.
-.br
-Le opzioni 'wrap' e 'scrollbind' sono impostate per migliorare la
-visibilità del testo.
-.br
-L'opzione 'foldmethod' è impostata al valore "diff", che mette gruppi di
-linee uguali fra i diversi file in una piegatura. 'foldcolumn' è impostato
-a due per poter facilmente visualizzare le piegature, aprirle e chiuderle.
-.SH OPZIONI
-Lo schermo è diviso verticalmente, come se aveste usato l'opzione "-O".
-Per dividerlo orizzontalmente, usare l'opzione "-o".
-.PP
-Per tutte le altre opzioni, vedere vim(1).
-.SH VEDERE ANCHE
-vim(1)
-.SH AUTORE
-Buona parte di
-.B Vim
-è stato scritto da Bram Moolenaar, con molto aiuto da altri.
-Vedere ":help credits" in
-.B Vim.
new file mode 100755
--- /dev/null
+++ b/runtime/doc/vimdiff-it.1
@@ -0,0 +1,48 @@
+.TH VIMDIFF 1 "30 marzo 2001"
+.SH NOME
+vimdiff \- modifica due o tre versioni di un file con Vim, visualizzando le
+differenze
+.SH SINTASSI
+.br
+.B vimdiff
+[opzioni] file1 file2 [file3]
+.PP
+.B gvimdiff
+.SH DESCRIZIONE
+.B Vimdiff
+inizia
+.B Vim
+per due (o tre) file.
+Ogni file ha una sua finestra.
+Le differenze fra file sono evidenziate.
+E' una maniera elegante per controllare modifiche e portare modifiche
+verso un'altra versione dello stesso file.
+.PP
+Vedere vim(1) per dettagli su Vim in generale.
+.PP
+Se iniziato con
+.B gvimdiff
+la GUI sarà utilizzata, se disponibile.
+.PP
+In ogni finestra l'opzione 'diff' è impostata, evidenziando così le
+differenze.
+.br
+Le opzioni 'wrap' e 'scrollbind' sono impostate per migliorare la
+visibilità del testo.
+.br
+L'opzione 'foldmethod' è impostata al valore "diff", che mette gruppi di
+linee uguali fra i diversi file in una piegatura. 'foldcolumn' è impostato
+a due per poter facilmente visualizzare le piegature, aprirle e chiuderle.
+.SH OPZIONI
+Lo schermo è diviso verticalmente, come se aveste usato l'opzione "-O".
+Per dividerlo orizzontalmente, usare l'opzione "-o".
+.PP
+Per tutte le altre opzioni, vedere vim(1).
+.SH VEDERE ANCHE
+vim(1)
+.SH AUTORE
+Buona parte di
+.B Vim
+è stato scritto da Bram Moolenaar, con molto aiuto da altri.
+Vedere ":help credits" in
+.B Vim.
deleted file mode 100755
--- a/runtime/doc/vimtu-it.1
+++ /dev/null
@@ -1,54 +0,0 @@
-.TH VIMTUTOR 1 "2001 April 2"
-.SH NOME
-vimtutor \- the Vim tutor
-.SH SINTASSI
-.br
-.B vimtutor [lingua]
-.SH DESCRIZIONE
-.B Vimtutor
-inizia il
-.B Vim
-tutor.
-It copies the tutor file first, so that it can be modified without changing
-the original file.
-.PP
-The
-.B Vimtutor
-is useful for people that want to learn their first
-.B Vim
-commands.
-.PP
-The optional [language] argument is the two-letter name of a language, like
-"it" or "es".
-If the [language] argument is missing, the language of the current locale will
-be used.
-If a tutor in this language is available, it will be used.
-Otherwise the English version will be used.
-.PP
-.B Vim
-is always started in Vi compatible mode.
-.SH FILE
-.TP 15
-/usr/local/lib/vim/tutor/tutor[.language]
-The
-.B Vimtutor
-text file(s).
-.TP 15
-/usr/local/lib/vim/tutor/tutor.vim
-The Vim script used to copy the
-.B Vimtutor
-text file.
-.SH AUTORE
-The
-.B Vimtutor
-è stato scritto in origine per Vi da Michael C. Pierce e Robert K. Ware,
-Colorado School of Mines, usando idee fornite da Charles Smith,
-Colorado State University.
-E-mail: bware@mines.colorado.edu.
-.br
-E' stato modificato per
-.B Vim
-da Bram Moolenaar.
-Per i nomi dei traduttori, vedere i file usati nelle rispettive lingue.
-.SH VEDERE ANCHE
-vim(1)
new file mode 100755
--- /dev/null
+++ b/runtime/doc/vimtutor-it.1
@@ -0,0 +1,54 @@
+.TH VIMTUTOR 1 "2001 April 2"
+.SH NOME
+vimtutor \- the Vim tutor
+.SH SINTASSI
+.br
+.B vimtutor [lingua]
+.SH DESCRIZIONE
+.B Vimtutor
+inizia il
+.B Vim
+tutor.
+It copies the tutor file first, so that it can be modified without changing
+the original file.
+.PP
+The
+.B Vimtutor
+is useful for people that want to learn their first
+.B Vim
+commands.
+.PP
+The optional [language] argument is the two-letter name of a language, like
+"it" or "es".
+If the [language] argument is missing, the language of the current locale will
+be used.
+If a tutor in this language is available, it will be used.
+Otherwise the English version will be used.
+.PP
+.B Vim
+is always started in Vi compatible mode.
+.SH FILE
+.TP 15
+/usr/local/lib/vim/tutor/tutor[.language]
+The
+.B Vimtutor
+text file(s).
+.TP 15
+/usr/local/lib/vim/tutor/tutor.vim
+The Vim script used to copy the
+.B Vimtutor
+text file.
+.SH AUTORE
+The
+.B Vimtutor
+è stato scritto in origine per Vi da Michael C. Pierce e Robert K. Ware,
+Colorado School of Mines, usando idee fornite da Charles Smith,
+Colorado State University.
+E-mail: bware@mines.colorado.edu.
+.br
+E' stato modificato per
+.B Vim
+da Bram Moolenaar.
+Per i nomi dei traduttori, vedere i file usati nelle rispettive lingue.
+.SH VEDERE ANCHE
+vim(1)
--- a/runtime/doc/windows.txt
+++ b/runtime/doc/windows.txt
@@ -1,4 +1,4 @@
-*windows.txt*   For Vim version 7.0aa.  Last change: 2004 Apr 29
+*windows.txt*   For Vim version 7.0aa.  Last change: 2004 Dec 21
 
 
 		  VIM REFERENCE MANUAL    by Bram Moolenaar
@@ -101,6 +101,8 @@ when the last window also has a status l
 	'laststatus' = 2	always a status line
 
 You can change the contents of the status line with the 'statusline' option.
+This option can be local to the window, so that you can have a different
+status line in each window.
 
 Normally, inversion is used to display the status line.  This can be changed
 with the 's' character in the 'highlight' option.  For example, "sb" sets it to
--- a/runtime/optwin.vim
+++ b/runtime/optwin.vim
@@ -1,7 +1,7 @@
 " These commands create the option window.
 "
 " Maintainer:	Bram Moolenaar <Bram@vim.org>
-" Last Change:	2004 Dec 09
+" Last Change:	2004 Dec 20
 
 " If there already is an option window, jump to that one.
 if bufwinnr("option-window") > 0
@@ -925,6 +925,10 @@ call append("$", "wildcharm\tlike 'wildc
 call append("$", " \tset wcm=" . &wcm)
 call append("$", "wildmode\tspecifies how command line completion works")
 call <SID>OptionG("wim", &wim)
+if has("wildoptions")
+  call append("$", "wildoptions\tempty or \"tagfile\" to list file name of matching tags")
+  call <SID>OptionG("wop", &wop)
+endif
 call append("$", "suffixes\tlist of file name extensions that have a lower priority")
 call <SID>OptionG("su", &su)
 if has("file_in_path")
--- a/src/Makefile
+++ b/src/Makefile
@@ -122,7 +122,7 @@
 #		make installruntime	only installs the Vim help and
 #							runtime files
 #		make installlinks	only installs the Vim binary links
-#		make installhelplinks	only installs the Vim manpage links
+#		make installmanlinks	only installs the Vim manpage links
 #		make installmacros	only installs the Vim macros
 #		make installtutor	only installs the Vim tutor
 #		make installtools	only installs xxd
@@ -848,8 +848,8 @@ TOOLS = xxd/xxd$(EXEEXT)
 #		directories.  This directory must exist.
 #DESTDIR  = ~/pkg/vim
 
-### Location of man pages
-MANSUBDIR = $(MANDIR)/man1
+### Directory of the man pages
+MAN1DIR = /man1
 
 ### Vim version (adjusted by a script)
 VIMMAJOR = 7
@@ -1067,7 +1067,7 @@ KDE_LIBS1	=
 KDE_LIBS2	=
 KDE_INSTALL     = install_normal
 KDE_TARGETS	= installglinks installkdeicons
-KDE_MAN_TARGETS = installghelplinks
+KDE_MAN_TARGETS = yes
 KDE_TESTTARGET  = gui
 
 ### GTK GUI
@@ -1083,7 +1083,7 @@ GTK_LIBS1	=
 GTK_LIBS2	= $(GTK_LIBNAME)
 GTK_INSTALL     = install_normal
 GTK_TARGETS	= installglinks
-GTK_MAN_TARGETS = installghelplinks
+GTK_MAN_TARGETS = yes
 GTK_TESTTARGET  = gui
 
 ### Motif GUI
@@ -1097,7 +1097,7 @@ MOTIF_LIBS1	=
 MOTIF_LIBS2	= $(MOTIF_LIBNAME) -lXt
 MOTIF_INSTALL   = install_normal
 MOTIF_TARGETS	= installglinks
-MOTIF_MAN_TARGETS = installghelplinks
+MOTIF_MAN_TARGETS = yes
 MOTIF_TESTTARGET = gui
 
 ### Athena GUI
@@ -1126,7 +1126,7 @@ ATHENA_LIBS1	= $(XAW_LIB)
 ATHENA_LIBS2	= -lXt
 ATHENA_INSTALL  = install_normal
 ATHENA_TARGETS	= installglinks
-ATHENA_MAN_TARGETS = installghelplinks
+ATHENA_MAN_TARGETS = yes
 ATHENA_TESTTARGET = gui
 
 ### neXtaw GUI
@@ -1143,7 +1143,7 @@ NEXTAW_LIBS1	= $(NEXTAW_LIB)
 NEXTAW_LIBS2	= -lXt
 NEXTAW_INSTALL  =  install_normal
 NEXTAW_TARGETS	=  installglinks
-NEXTAW_MAN_TARGETS = installghelplinks
+NEXTAW_MAN_TARGETS = yes
 NEXTAW_TESTTARGET = gui
 
 ### (J)  Sun OpenWindows 3.2 (SunOS 4.1.x) or earlier that produce these ld
@@ -1167,7 +1167,7 @@ BEOSGUI_LIBS1	= -lbe -lroot
 BEOSGUI_LIBS2	=
 BEOSGUI_INSTALL = install_normal
 BEOSGUI_TARGETS	= installglinks
-BEOSGUI_MAN_TARGETS = installghelplinks
+BEOSGUI_MAN_TARGETS = yes
 BEOSGUI_TESTTARGET = gui
 
 # PHOTON GUI
@@ -1180,7 +1180,7 @@ PHOTONGUI_LIBS1	= -lph -lphexlib
 PHOTONGUI_LIBS2	=
 PHOTONGUI_INSTALL = install_normal
 PHOTONGUI_TARGETS = installglinks
-PHOTONGUI_MAN_TARGETS = installghelplinks
+PHOTONGUI_MAN_TARGETS = yes
 PHOTONGUI_TESTTARGET = gui
 
 # CARBON GUI
@@ -1277,7 +1277,9 @@ DEST_TOOLS = $(DESTDIR)$(TOOLSSUBLOC)
 DEST_TUTOR = $(DESTDIR)$(TUTORSUBLOC)
 DEST_SCRIPT = $(DESTDIR)$(SCRIPTLOC)
 DEST_PRINT = $(DESTDIR)$(PRINTSUBLOC)
-DEST_MAN = $(DESTDIR)$(MANSUBDIR)
+DEST_MAN_TOP = $(DESTDIR)$(MANDIR)
+DEST_MAN = $(DEST_MAN_TOP)$(MAN1DIR)
+DEST_MAN_IT = $(DEST_MAN_TOP)/it$(MAN1DIR)
 
 #	     BASIC_SRC: files that are always used
 #	       GUI_SRC: extra GUI files for current configuration
@@ -1661,7 +1663,7 @@ install: $(GUI_INSTALL)
 
 install_normal: installvim installtools install-languages install-icons
 
-installvim: installvimbin installruntime installlinks installhelplinks installmacros installtutor
+installvim: installvimbin installruntime installlinks installmanlinks installmacros installtutor
 
 installvimbin: $(VIMTARGET) $(DESTDIR)$(exec_prefix) $(DEST_BIN)
 	-if test -f $(DEST_BIN)/$(VIMTARGET); then \
@@ -1674,37 +1676,16 @@ installvimbin: $(VIMTARGET) $(DESTDIR)$(
 # may create a link to the new executable from /usr/bin/vi
 	-$(LINKIT)
 
-# install the help files; first adjust the contents for the location
-installruntime: $(HELPSOURCE)/vim.1 $(DEST_MAN) $(DEST_VIM) $(DEST_RT) \
+# Long list of arguments for the shell script that installs the manual pages
+# for one language.
+INSTALLMANARGS = $(VIMLOC) $(SCRIPTLOC) $(VIMRCLOC) $(HELPSOURCE) $(MANMOD) \
+		$(VIMNAME) $(VIMDIFFNAME) $(EVIMNAME)
+
+# install the help files; first adjust the contents for the final location
+installruntime: $(HELPSOURCE)/vim.1 $(DEST_VIM) $(DEST_RT) \
 		$(DEST_HELP) $(DEST_PRINT) $(DEST_COL) $(DEST_SYN) $(DEST_IND) \
 		$(DEST_FTP) $(DEST_PLUG) $(DEST_TUTOR) $(DEST_COMP)
-	@echo generating $(DEST_MAN)/$(VIMNAME).1
-	@sed -e s+/usr/local/lib/vim+$(VIMLOC)+ \
-		-e s+$(VIMLOC)/doc+$(HELPSUBLOC)+ \
-		-e s+$(VIMLOC)/syntax+$(SYNSUBLOC)+ \
-		-e s+$(VIMLOC)/tutor+$(TUTORSUBLOC)+ \
-		-e s+$(VIMLOC)/vimrc+$(VIMRCLOC)/vimrc+ \
-		-e s+$(VIMLOC)/gvimrc+$(VIMRCLOC)/gvimrc+ \
-		-e s+$(VIMLOC)/menu.vim+$(SCRIPTLOC)/menu.vim+ \
-		-e s+$(VIMLOC)/bugreport.vim+$(SCRIPTLOC)/bugreport.vim+ \
-		-e s+$(VIMLOC)/filetype.vim+$(SCRIPTLOC)/filetype.vim+ \
-		-e s+$(VIMLOC)/ftoff.vim+$(SCRIPTLOC)/ftoff.vim+ \
-		-e s+$(VIMLOC)/scripts.vim+$(SCRIPTLOC)/scripts.vim+ \
-		-e s+$(VIMLOC)/optwin.vim+$(SCRIPTLOC)/optwin.vim+ \
-		-e 's+$(VIMLOC)/\*.ps+$(SCRIPTLOC)/\*.ps+' \
-		$(HELPSOURCE)/vim.1 > $(DEST_MAN)/$(VIMNAME).1
-	chmod $(MANMOD) $(DEST_MAN)/$(VIMNAME).1
-	@echo generating $(DEST_MAN)/$(VIMNAME)tutor.1
-	@sed -e s+/usr/local/lib/vim+$(VIMLOC)+ \
-		-e s+$(VIMLOC)/tutor+$(TUTORSUBLOC)+ \
-		$(HELPSOURCE)/vimtutor.1 > $(DEST_MAN)/$(VIMNAME)tutor.1
-	chmod $(MANMOD) $(DEST_MAN)/$(VIMNAME)tutor.1
-	$(INSTALL_DATA)  $(HELPSOURCE)/vimdiff.1 $(DEST_MAN)/$(VIMDIFFNAME).1
-	chmod $(MANMOD) $(DEST_MAN)/$(VIMDIFFNAME).1
-	@echo generating $(DEST_MAN)/$(EVIMNAME).1
-	@sed -e s+/usr/local/lib/vim+$(SCRIPTLOC)+ \
-		$(HELPSOURCE)/evim.1 > $(DEST_MAN)/$(EVIMNAME).1
-	chmod $(MANMOD) $(DEST_MAN)/$(EVIMNAME).1
+	-$(SHELL) ./installman.sh install $(DEST_MAN) "" $(INSTALLMANARGS)
 	@echo generating help tags
 # Generate the help tags with ":helptags" to handle all languages.
 	-@cd $(HELPSOURCE); $(MAKE) VIMEXE=$(DEST_BIN)/$(VIMTARGET) vimtags
@@ -1794,7 +1775,7 @@ installtutor: $(TUTORSOURCE) $(DEST_VIM)
 	chmod $(HELPMOD) $(DEST_TUTOR)/*
 
 # install helper program xxd
-installtools: $(TOOLS) $(DESTDIR)$(exec_prefix) $(DEST_BIN) $(DEST_MAN) \
+installtools: $(TOOLS) $(DESTDIR)$(exec_prefix) $(DEST_BIN) \
 		$(TOOLSSOURCE) $(DEST_VIM) $(DEST_RT) $(DEST_TOOLS)
 	if test -f $(DEST_BIN)/xxd$(EXEEXT); then \
 	  mv -f $(DEST_BIN)/xxd$(EXEEXT) $(DEST_BIN)/xxd.rm; \
@@ -1803,8 +1784,8 @@ installtools: $(TOOLS) $(DESTDIR)$(exec_
 	$(INSTALL_PROG) xxd/xxd$(EXEEXT) $(DEST_BIN)
 	$(STRIP) $(DEST_BIN)/xxd$(EXEEXT)
 	chmod $(BINMOD) $(DEST_BIN)/xxd$(EXEEXT)
-	$(INSTALL_DATA) $(HELPSOURCE)/xxd.1 $(DEST_MAN)
-	chmod $(MANMOD) $(DEST_MAN)/xxd.1
+	-$(SHELL) ./installman.sh xxd $(DEST_MAN) "" $(INSTALLMANARGS)
+	-$(SHELL) ./installman.sh xxd $(DEST_MAN_IT) "-it" $(INSTALLMANARGS)
 # install the runtime tools
 	$(INSTALL_DATA_R) $(TOOLSSOURCE)/* $(DEST_TOOLS)
 # When using CVS some CVS directories might have been copied.
@@ -1822,6 +1803,9 @@ installtools: $(TOOLS) $(DESTDIR)$(exec_
 
 # install the language specific files, if they were unpacked
 install-languages: languages $(DEST_LANG) $(DEST_KMAP)
+	-$(SHELL) ./installman.sh install $(DEST_MAN_IT) "-it" $(INSTALLMANARGS)
+	-$(SHELL) ./installml.sh install "$(GUI_MAN_TARGETS)" \
+		$(DEST_MAN_IT) $(INSTALLMLARGS)
 	if test -n "$(MAKEMO)" -a -f $(PODIR)/Makefile; then \
 	   cd $(PODIR); $(MAKE) prefix=$(DESTDIR)$(prefix) LOCALEDIR=$(DEST_LANG) \
 	   INSTALL_DATA=$(INSTALL_DATA) FILEMOD=$(FILEMOD) install; \
@@ -1877,7 +1861,8 @@ install-icons:
 	@echo You need to unpack the runtime archive before running "make install".
 	test -f error
 
-$(DESTDIR)$(exec_prefix) $(DEST_BIN) $(DEST_MAN) $(DEST_VIM) $(DEST_RT) $(DEST_HELP) \
+$(DESTDIR)$(exec_prefix) $(DEST_BIN) \
+		$(DEST_VIM) $(DEST_RT) $(DEST_HELP) \
 		$(DEST_PRINT) $(DEST_COL) $(DEST_SYN) $(DEST_IND) $(DEST_FTP) \
 		$(DEST_LANG) $(DEST_KMAP) $(DEST_COMP) \
 		$(DEST_MACRO) $(DEST_TOOLS) $(DEST_TUTOR) $(DEST_PLUG):
@@ -1942,69 +1927,36 @@ installgvimdiff: $(DEST_BIN)/$(GVIMDIFFT
 
 # create links for the manual pages with various names to vim.	This is only
 # done when the links (or manpages with the same name) don't exist yet.
-installhelplinks: $(GUI_MAN_TARGETS) \
-			$(DEST_MAN)/$(EXNAME).1 \
-			$(DEST_MAN)/$(VIEWNAME).1 \
-			$(DEST_MAN)/$(RVIMNAME).1 \
-			$(DEST_MAN)/$(RVIEWNAME).1
-
-installghelplinks: $(DEST_MAN)/$(GVIMNAME).1 \
-			$(DEST_MAN)/$(GVIEWNAME).1 \
-			$(DEST_MAN)/$(RGVIMNAME).1 \
-			$(DEST_MAN)/$(RGVIEWNAME).1 \
-			$(DEST_MAN)/$(GVIMDIFFNAME).1 \
-			$(DEST_MAN)/$(EVIEWNAME).1
-
-$(DEST_MAN)/$(EXNAME).1:
-	cd $(DEST_MAN); ln -s $(VIMNAME).1 $(EXNAME).1
-
-$(DEST_MAN)/$(VIEWNAME).1:
-	cd $(DEST_MAN); ln -s $(VIMNAME).1 $(VIEWNAME).1
-
-$(DEST_MAN)/$(GVIMNAME).1:
-	cd $(DEST_MAN); ln -s $(VIMNAME).1 $(GVIMNAME).1
-
-$(DEST_MAN)/$(GVIEWNAME).1:
-	cd $(DEST_MAN); ln -s $(VIMNAME).1 $(GVIEWNAME).1
-
-$(DEST_MAN)/$(RVIMNAME).1:
-	cd $(DEST_MAN); ln -s $(VIMNAME).1 $(RVIMNAME).1
-
-$(DEST_MAN)/$(RVIEWNAME).1:
-	cd $(DEST_MAN); ln -s $(VIMNAME).1 $(RVIEWNAME).1
-
-$(DEST_MAN)/$(RGVIMNAME).1:
-	cd $(DEST_MAN); ln -s $(VIMNAME).1 $(RGVIMNAME).1
-
-$(DEST_MAN)/$(RGVIEWNAME).1:
-	cd $(DEST_MAN); ln -s $(VIMNAME).1 $(RGVIEWNAME).1
-
-$(DEST_MAN)/$(GVIMDIFFNAME).1:
-	cd $(DEST_MAN); ln -s $(VIMDIFFNAME).1 $(GVIMDIFFNAME).1
-
-$(DEST_MAN)/$(EVIEWNAME).1:
-	cd $(DEST_MAN); ln -s $(EVIMNAME).1 $(EVIEWNAME).1
+
+INSTALLMLARGS = $(VIMNAME) $(VIMDIFFNAME) $(EVIMNAME) \
+		$(EXNAME) $(VIEWNAME) $(RVIMNAME) $(RVIEWNAME) \
+		$(GVIMNAME) $(GVIEWNAME) $(RGVIMNAME) $(RGVIEWNAME) \
+		$(GVIMDIFFNAME) $(EVIEWNAME)
+
+installmanlinks: 
+	-$(SHELL) ./installml.sh install "$(GUI_MAN_TARGETS)" \
+		$(DEST_MAN) $(INSTALLMLARGS)
 
 uninstall: uninstall_runtime
 	-rm -f $(DEST_BIN)/$(VIMTARGET)
-	-rm -f $(DEST_MAN)/$(VIMNAME).1 $(DEST_MAN)/$(VIMNAME)tutor.1
 	-rm -f $(DEST_BIN)/vimtutor
-	-rm -f $(DEST_BIN)/xxd$(EXEEXT) $(DEST_MAN)/xxd.1
 	-rm -f $(DEST_BIN)/$(EXTARGET) $(DEST_BIN)/$(VIEWTARGET)
 	-rm -f $(DEST_BIN)/$(GVIMTARGET) $(DEST_BIN)/$(GVIEWTARGET)
 	-rm -f $(DEST_BIN)/$(RVIMTARGET) $(DEST_BIN)/$(RVIEWTARGET)
 	-rm -f $(DEST_BIN)/$(RGVIMTARGET) $(DEST_BIN)/$(RGVIEWTARGET)
 	-rm -f $(DEST_BIN)/$(VIMDIFFTARGET) $(DEST_BIN)/$(GVIMDIFFTARGET)
 	-rm -f $(DEST_BIN)/$(EVIMTARGET) $(DEST_BIN)/$(EVIEWTARGET)
-	-rm -f $(DEST_MAN)/$(EXNAME).1 $(DEST_MAN)/$(VIEWNAME).1
-	-rm -f $(DEST_MAN)/$(GVIMNAME).1 $(DEST_MAN)/$(GVIEWNAME).1
-	-rm -f $(DEST_MAN)/$(RVIMNAME).1 $(DEST_MAN)/$(RVIEWNAME).1
-	-rm -f $(DEST_MAN)/$(RGVIMNAME).1 $(DEST_MAN)/$(RGVIEWNAME).1
-	-rm -f $(DEST_MAN)/$(VIMDIFFNAME).1 $(DEST_MAN)/$(GVIMDIFFNAME).1
-	-rm -f $(DEST_MAN)/$(EVIMNAME).1 $(DEST_MAN)/$(EVIEWNAME).1
+	-rm -f $(DEST_BIN)/xxd$(EXEEXT)
 
 # Note: the "rmdir" will fail if any files were added after "make install"
 uninstall_runtime:
+	-$(SHELL) ./installman.sh uninstall $(DEST_MAN) "" $(INSTALLMANARGS)
+	-$(SHELL) ./installman.sh uninstall $(DEST_MAN_IT) "-it" $(INSTALLMANARGS)
+	-$(SHELL) ./installml.sh uninstall "$(GUI_MAN_TARGETS)" \
+		$(DEST_MAN) $(INSTALLMLARGS)
+	-$(SHELL) ./installml.sh uninstall "$(GUI_MAN_TARGETS)" \
+		$(DEST_MAN_IT) $(INSTALLMLARGS)
+	-rm -f $(DEST_MAN)/xxd.1 $(DEST_MAN_IT)/xxd.1
 	-rm -f $(DEST_HELP)/*.txt $(DEST_HELP)/tags $(DEST_HELP)/*.pl
 	-rm -f $(DEST_HELP)/*.??x $(DEST_HELP)/tags-??
 	-rm -f $(SYS_MENU_FILE) $(SYS_SYNMENU_FILE) $(SYS_DELMENU_FILE)
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -588,6 +588,9 @@ free_buffer(buf)
 #ifdef FEAT_RUBY
     ruby_buffer_free(buf);
 #endif
+#ifdef FEAT_AUTOCMD
+    aubuflocal_remove(buf);
+#endif
     vim_free(buf);
 }
 
--- a/src/charset.c
+++ b/src/charset.c
@@ -816,11 +816,8 @@ win_linetabsize(wp, p, len)
     colnr_T	col = 0;
     char_u	*s;
 
-    for (s = p; *s != NUL && (len == MAXCOL || s < p + len); )
-    {
+    for (s = p; *s != NUL && (len == MAXCOL || s < p + len); mb_ptr_adv(s))
 	col += win_lbr_chartabsize(wp, s, col, NULL);
-	mb_ptr_adv(s);
-    }
     return (int)col;
 }
 
--- a/src/ex_cmds.c
+++ b/src/ex_cmds.c
@@ -5216,6 +5216,28 @@ fix_help_buffer()
     }
 }
 
+/*
+ * ":exusage"
+ */
+/*ARGSUSED*/
+    void
+ex_exusage(eap)
+    exarg_T	*eap;
+{
+    do_cmdline_cmd((char_u *)"help ex-cmd-index");
+}
+
+/*
+ * ":viusage"
+ */
+/*ARGSUSED*/
+    void
+ex_viusage(eap)
+    exarg_T	*eap;
+{
+    do_cmdline_cmd((char_u *)"help normal-index");
+}
+
 #if defined(FEAT_EX_EXTRA) || defined(PROTO)
 static void helptags_one __ARGS((char_u *dir, char_u *ext, char_u *lang));
 
--- a/src/ex_cmds.h
+++ b/src/ex_cmds.h
@@ -352,6 +352,8 @@ EX(CMD_execute,		"execute",	ex_execute,
 			EXTRA|NOTRLCOM|SBOXOK|CMDWIN),
 EX(CMD_exit,		"exit",		ex_exit,
 			RANGE|WHOLEFOLD|BANG|FILE1|ARGOPT|DFLALL|TRLBAR|CMDWIN),
+EX(CMD_exusage,		"exusage",	ex_exusage,
+			TRLBAR),
 EX(CMD_file,		"file",		ex_file,
 			RANGE|NOTADR|ZEROR|BANG|FILE1|TRLBAR),
 EX(CMD_files,		"files",	buflist_list,
@@ -836,6 +838,8 @@ EX(CMD_visual,		"visual",	ex_edit,
 			BANG|FILE1|EDITCMD|ARGOPT|TRLBAR),
 EX(CMD_view,		"view",		ex_edit,
 			BANG|FILE1|EDITCMD|ARGOPT|TRLBAR),
+EX(CMD_viusage,		"viusage",	ex_viusage,
+			TRLBAR),
 EX(CMD_vmap,		"vmap",		ex_map,
 			EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN),
 EX(CMD_vmapclear,	"vmapclear",	ex_mapclear,
--- a/src/ex_cmds2.c
+++ b/src/ex_cmds2.c
@@ -2152,7 +2152,7 @@ static FILE *fopen_noinh_readbin __ARGS(
 fopen_noinh_readbin(filename)
     char    *filename;
 {
-    int	fd_tmp = open(filename, O_RDONLY | O_BINARY | O_NOINHERIT);
+    int	fd_tmp = mch_open(filename, O_RDONLY | O_BINARY | O_NOINHERIT, 0);
 
     if (fd_tmp == -1)
 	return NULL;
--- a/src/ex_docmd.c
+++ b/src/ex_docmd.c
@@ -3174,7 +3174,7 @@ set_one_cmd_context(xp, buff)
 	xp->xp_pattern = skipwhite(arg);
 	for (p = xp->xp_pattern; *p; )
 	{
-	    if (*p == '\\' && p[1])
+	    if (*p == '\\' && p[1] != NUL)
 		++p;
 #ifdef SPACE_IN_FILENAME
 	    else if (vim_iswhite(*p) && (!(argt & NOSPC) || usefilter))
@@ -3440,7 +3440,10 @@ set_one_cmd_context(xp, buff)
 	case CMD_tjump:
 	case CMD_stjump:
 	case CMD_ptjump:
-	    xp->xp_context = EXPAND_TAGS;
+	    if (*p_wop != NUL)
+		xp->xp_context = EXPAND_TAGS_LISTFILES;
+	    else
+		xp->xp_context = EXPAND_TAGS;
 	    xp->xp_pattern = arg;
 	    break;
 	case CMD_augroup:
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -6590,6 +6590,7 @@ typedef struct AutoPat
     char	    last;		/* last pattern for apply_autocmds() */
     AutoCmd	    *cmds;		/* list of commands to do */
     struct AutoPat  *next;		/* next AutoPat in AutoPat list */
+    int		    buflocal_nr;	/* !=0 for buffer-local AutoPat */
 } AutoPat;
 
 static struct event_name
@@ -6686,8 +6687,13 @@ typedef struct AutoPatCmd
     char_u	*sfname;	/* sfname to match with */
     char_u	*tail;		/* tail of fname */
     EVENT_T	event;		/* current event */
+    int		arg_bufnr;	/* initially equal to <abuf>, set to zero when
+				   buf is deleted */
+    struct AutoPatCmd   *next;	/* chain of active apc-s for auto-invalidation*/
 } AutoPatCmd;
 
+AutoPatCmd *active_apc_list = NULL;	/* stack of active autocommands */
+
 /*
  * augroups stores a list of autocmd group names.
  */
@@ -6721,6 +6727,7 @@ static char_u *getnextac __ARGS((int c, 
 static int apply_autocmds_group __ARGS((EVENT_T event, char_u *fname, char_u *fname_io, int force, int group, buf_T *buf, exarg_T *eap));
 static void auto_next_pat __ARGS((AutoPatCmd *apc, int stop_at_last));
 
+
 static EVENT_T	last_event;
 static int	last_group;
 
@@ -6795,6 +6802,7 @@ au_remove_pat(ap)
 {
     vim_free(ap->pat);
     ap->pat = NULL;
+    ap->buflocal_nr = -1;
     au_need_clean = TRUE;
 }
 
@@ -6869,6 +6877,39 @@ au_cleanup()
 }
 
 /*
+ * Called when buffer is freed, to remove/invalidate related buffer-local
+ * autocmds.
+ */
+    void
+aubuflocal_remove(buf)
+    buf_T	*buf;
+{
+    AutoPat	*ap;
+    EVENT_T	event;
+    AutoPatCmd	*apc;
+
+    /* invalidate currently executing autocommands */
+    for (apc = active_apc_list; apc; apc = apc->next)
+	if (buf->b_fnum == apc->arg_bufnr)
+	    apc->arg_bufnr = 0;
+
+    /* invalidate buflocals looping through events */
+    for (event = (EVENT_T)0; (int)event < (int)NUM_EVENTS;
+					    event = (EVENT_T)((int)event + 1))
+	/* loop over all autocommand patterns */
+	for (ap = first_autopat[(int)event]; ap != NULL; ap = ap->next)
+	    if (ap->buflocal_nr == buf->b_fnum)
+	    {
+		au_remove_pat(ap);
+		if (p_verbose >= 6)
+		    smsg((char_u *)
+			    _("auto-removing autocommand: %s <buffer=%d>"),
+					   event_nr2name(event), buf->b_fnum);
+	    }
+    au_cleanup();
+}
+
+/*
  * Add an autocmd group name.
  * Return it's ID.  Returns AUGROUP_ERROR (< 0) for error.
  */
@@ -7292,6 +7333,9 @@ do_autocmd_event(event, pat, nested, cmd
     int		findgroup;
     int		allgroups;
     int		patlen;
+    int	        is_buflocal;
+    int		buflocal_nr;
+    char_u	buflocal_pat[25];	/* for "<buffer=X>" */
 
     if (group == AUGROUP_ALL)
 	findgroup = current_augroup;
@@ -7339,6 +7383,39 @@ do_autocmd_event(event, pat, nested, cmd
 	patlen = (int)(endpat - pat);
 
 	/*
+	 * detect special <buflocal[=X]> buffer-local patterns
+	 */
+	is_buflocal = FALSE;
+	buflocal_nr = 0;
+
+	if (patlen >= 7 && STRNCMP(pat, "<buffer", 7) == 0
+						    && pat[patlen - 1] == '>')
+	{
+	    /* Error will be printed only for addition. printing and removing
+	     * will proceed silently. */
+	    is_buflocal = TRUE;
+	    if (patlen == 8)
+		buflocal_nr = curbuf->b_fnum;
+	    else if (patlen > 9 && pat[7] == '=')
+	    {
+		/* <buffer=abuf> */
+		if (patlen == 13 && STRNICMP(pat, "<buffer=abuf>", 13))
+		    buflocal_nr = autocmd_bufnr;
+		/* <buffer=123> */
+		else if (skipdigits(pat + 8) == pat + patlen - 1)
+		    buflocal_nr = atoi((char *)pat + 8);
+	    }
+	}
+
+	if (is_buflocal)
+	{
+	    /* normalize pat into standard "<buffer>#N" form */
+	    sprintf((char *)buflocal_pat, "<buffer=%d>", buflocal_nr);
+	    pat = buflocal_pat;			/* can modify pat and patlen */
+	    patlen = STRLEN(buflocal_pat);	/*   but not endpat */
+	}
+
+	/*
 	 * Find AutoPat entries with this pattern.
 	 */
 	prev_ap = &first_autopat[(int)event];
@@ -7351,7 +7428,9 @@ do_autocmd_event(event, pat, nested, cmd
 		 *   not specified and it's the current group, or a group was
 		 *   not specified and we are listing
 		 * - the length of the pattern matches
-		 * - the pattern matches
+		 * - the pattern matches.
+		 * For <buffer[=X]>, this condition works because we normalize
+		 * all buffer-local patterns.
 		 */
 		if ((allgroups || ap->group == findgroup)
 			&& ap->patlen == patlen
@@ -7374,7 +7453,7 @@ do_autocmd_event(event, pat, nested, cmd
 		    }
 
 		    /*
-		     * Show autocmd's for this autopat
+		     * Show autocmd's for this autopat, or buflocals <buffer=X>
 		     */
 		    else if (*cmd == NUL)
 			show_autocmd(ap, event);
@@ -7401,6 +7480,15 @@ do_autocmd_event(event, pat, nested, cmd
 	     */
 	    if (ap == NULL)
 	    {
+		/* refuse to add buffer-local ap if buffer number is invalid */
+		if (is_buflocal && (buflocal_nr == 0
+				      || buflist_findnr(buflocal_nr) == NULL))
+		{
+		    EMSGN(_("E680: <buffer=%d>: invalid buffer number "),
+								 buflocal_nr);
+		    return FAIL;
+		}
+
 		ap = (AutoPat *)alloc((unsigned)sizeof(AutoPat));
 		if (ap == NULL)
 		    return FAIL;
@@ -7411,13 +7499,23 @@ do_autocmd_event(event, pat, nested, cmd
 		    vim_free(ap);
 		    return FAIL;
 		}
-		ap->reg_pat = file_pat_to_reg_pat(pat, endpat,
-						       &ap->allow_dirs, TRUE);
-		if (ap->reg_pat == NULL)
+
+		if (is_buflocal)
+		{
+		    ap->buflocal_nr = buflocal_nr;
+		    ap->reg_pat = NULL;
+		}
+		else
 		{
-		    vim_free(ap->pat);
-		    vim_free(ap);
-		    return FAIL;
+		    ap->buflocal_nr = 0;
+		    ap->reg_pat = file_pat_to_reg_pat(pat, endpat,
+							 &ap->allow_dirs, TRUE);
+		    if (ap->reg_pat == NULL)
+		    {
+			vim_free(ap->pat);
+			vim_free(ap);
+			return FAIL;
+		    }
 		}
 		ap->cmds = NULL;
 		*prev_ap = ap;
@@ -7786,14 +7884,14 @@ apply_autocmds_group(event, fname, fname
      * autocommands are blocked.
      */
     if (first_autopat[(int)event] == NULL || autocmd_block > 0)
-	return retval;
+	goto BYPASS_AU;
 
     /*
      * When autocommands are busy, new autocommands are only executed when
      * explicitly enabled with the "nested" flag.
      */
     if (autocmd_busy && !(force || autocmd_nested))
-	return retval;
+	goto BYPASS_AU;
 
 #ifdef FEAT_EVAL
     /*
@@ -7801,20 +7899,20 @@ apply_autocmds_group(event, fname, fname
      * occurred or an exception was thrown but not caught.
      */
     if (aborting())
-	return retval;
+	goto BYPASS_AU;
 #endif
 
     /*
      * FileChangedShell never nests, because it can create an endless loop.
      */
     if (filechangeshell_busy && event == EVENT_FILECHANGEDSHELL)
-	return retval;
+	goto BYPASS_AU;
 
     /*
      * Ignore events in 'eventignore'.
      */
     if (event_ignored(event))
-	return retval;
+	goto BYPASS_AU;
 
     /*
      * Allow nesting of autocommands, but restrict the depth, because it's
@@ -7823,7 +7921,7 @@ apply_autocmds_group(event, fname, fname
     if (nesting == 10)
     {
 	EMSG(_("E218: autocommand nesting too deep"));
-	return retval;
+	goto BYPASS_AU;
     }
 
     /*
@@ -7834,7 +7932,7 @@ apply_autocmds_group(event, fname, fname
 		&& (event == EVENT_WINENTER || event == EVENT_BUFENTER))
 	    || (autocmd_no_leave
 		&& (event == EVENT_WINLEAVE || event == EVENT_BUFLEAVE)))
-	return retval;
+	goto BYPASS_AU;
 
     /*
      * Save the autocmd_* variables and info about the current buffer.
@@ -7904,7 +8002,7 @@ apply_autocmds_group(event, fname, fname
 	sfname = vim_strsave(fname);
 	/* Don't try expanding FileType, Syntax or WindowID. */
 	if (event == EVENT_FILETYPE || event == EVENT_SYNTAX
-		|| event == EVENT_REMOTEREPLY)
+						|| event == EVENT_REMOTEREPLY)
 	    fname = vim_strsave(fname);
 	else
 	    fname = FullName_save(fname, FALSE);
@@ -7912,7 +8010,8 @@ apply_autocmds_group(event, fname, fname
     if (fname == NULL)	    /* out of memory */
     {
 	vim_free(sfname);
-	return FALSE;
+	retval = FALSE;
+	goto BYPASS_AU;
     }
 
 #ifdef BACKSLASH_IN_FILENAME
@@ -7983,11 +8082,17 @@ apply_autocmds_group(event, fname, fname
     patcmd.sfname = sfname;
     patcmd.tail = tail;
     patcmd.event = event;
+    patcmd.arg_bufnr = autocmd_bufnr;
+    patcmd.next = NULL;
     auto_next_pat(&patcmd, FALSE);
 
     /* found one, start executing the autocommands */
     if (patcmd.curpat != NULL)
     {
+	/* add to active_apc_list */
+	patcmd.next = active_apc_list;
+	active_apc_list = &patcmd;
+
 #ifdef FEAT_EVAL
 	/* set v:cmdarg (only when there is a matching pattern) */
 	save_cmdbang = get_vim_var_nr(VV_CMDBANG);
@@ -8015,6 +8120,9 @@ apply_autocmds_group(event, fname, fname
 	    set_vim_var_nr(VV_CMDBANG, save_cmdbang);
 	}
 #endif
+	/* delete from active_apc_list */
+	if (active_apc_list == &patcmd)	    /* just in case */
+	    active_apc_list = patcmd.next;
     }
 
     --RedrawingDisabled;
@@ -8065,6 +8173,13 @@ apply_autocmds_group(event, fname, fname
     }
 
     au_cleanup();	/* may really delete removed patterns/commands now */
+
+BYPASS_AU:
+    /* When wiping out a buffer make sure all its buffer-local autocommands
+     * are deleted. */
+    if (event == EVENT_BUFWIPEOUT && buf != NULL)
+	aubuflocal_remove(buf);
+
     return retval;
 }
 
@@ -8089,12 +8204,16 @@ auto_next_pat(apc, stop_at_last)
 	apc->curpat = NULL;
 
 	/* only use a pattern when it has not been removed, has commands and
-	 * the group matches */
+	 * the group matches. For buffer-local autocommands only check the
+	 * buffer number. */
 	if (ap->pat != NULL && ap->cmds != NULL
 		&& (apc->group == AUGROUP_ALL || apc->group == ap->group))
 	{
-	    if (match_file_pat(ap->reg_pat, apc->fname, apc->sfname, apc->tail,
-							      ap->allow_dirs))
+	    /* execution-condition */
+	    if (ap->buflocal_nr == 0
+		    ? (match_file_pat(ap->reg_pat, apc->fname, apc->sfname,
+						   apc->tail, ap->allow_dirs))
+		    : ap->buflocal_nr == apc->arg_bufnr)
 	    {
 		name = event_nr2name(apc->event);
 		s = _("%s Auto commands for \"%s\"");
@@ -8191,11 +8310,14 @@ getnextac(c, cookie, indent)
 
 /*
  * Return TRUE if there is a matching autocommand for "fname".
+ * To account for buffer-local autocommands, function needs to know
+ * in which buffer the file will be opened.
  */
     int
-has_autocmd(event, sfname)
+has_autocmd(event, sfname, buf)
     EVENT_T	event;
     char_u	*sfname;
+    buf_T       *buf;
 {
     AutoPat	*ap;
     char_u	*fname;
@@ -8219,8 +8341,11 @@ has_autocmd(event, sfname)
 
     for (ap = first_autopat[(int)event]; ap != NULL; ap = ap->next)
 	if (ap->pat != NULL && ap->cmds != NULL
-		&& match_file_pat(ap->reg_pat, fname, sfname, tail,
-							      ap->allow_dirs))
+            && (ap->buflocal_nr == 0
+		? match_file_pat(ap->reg_pat, fname, sfname, tail,
+							       ap->allow_dirs)
+                : buf != NULL && ap->buflocal_nr == buf->b_fnum
+	   ))
 	{
 	    retval = TRUE;
 	    break;
@@ -8327,7 +8452,9 @@ get_event_name(xp, idx)
 
 /*
  * Return TRUE if an autocommand is defined for "event" and "pattern".
- * "pattern" can be NULL to accept any pattern.
+ * "pattern" can be NULL to accept any pattern. Buffer-local patterns
+ * <buffer> or <buffer=N> are accepted.
+ * Used for exists("#Event#pat")
  */
     int
 au_exists(name, name_end, pattern)
@@ -8339,6 +8466,7 @@ au_exists(name, name_end, pattern)
     char_u	*p;
     EVENT_T	event;
     AutoPat	*ap;
+    buf_T	*buflocal_buf = NULL;
 
     /* find the index (enum) for the event name */
     event_name = vim_strnsave(name, (int)(name_end - name));
@@ -8360,15 +8488,24 @@ au_exists(name, name_end, pattern)
     if (pattern == NULL)
 	return TRUE;
 
+    /* if pattern is "<buffer>", special handling is needed which uses curbuf */
+    /* for pattern "<buffer=N>, fnamecmp() will work fine */
+    if (STRICMP(pattern, "<buffer>") == 0)
+	buflocal_buf = curbuf;
+
     /* Check if there is an autocommand with the given pattern. */
     for ( ; ap != NULL; ap = ap->next)
-	/* only use a pattern when it has not been removed and has commands */
+	/* only use a pattern when it has not been removed and has commands. */
+	/* For buffer-local autocommands, fnamecmp() works fine. */
 	if (ap->pat != NULL && ap->cmds != NULL
-					   && fnamecmp(ap->pat, pattern) == 0)
+	    && (buflocal_buf == NULL
+		 ? fnamecmp(ap->pat, pattern) == 0
+		 : ap->buflocal_nr == buflocal_buf->b_fnum))
 	    return TRUE;
 
     return FALSE;
 }
+
 #endif	/* FEAT_AUTOCMD */
 
 #if defined(FEAT_AUTOCMD) || defined(FEAT_WILDIGN) || defined(PROTO)
--- a/src/gui_gtk.c
+++ b/src/gui_gtk.c
@@ -2014,15 +2014,17 @@ split_button_string(char_u *button_strin
     if (array != NULL)
     {
 	array[count++] = (char *)button_string;
-	for (p = button_string; *p != NUL; mb_ptr_adv(p))
+	for (p = button_string; *p != NUL; )
 	{
 	    if (*p == DLG_BUTTON_SEP)
 	    {
-		*p = NUL;
-		array[count++] = (char *)p + 1;
+		*p++ = NUL;
+		array[count++] = (char *)p;
 	    }
 	    else if (*p == DLG_HOTKEY_CHAR)
-		*p = '_';
+		*p++ = '_';
+	    else
+		mb_ptr_adv(p);
 	}
 	array[count] = NULL; /* currently not relied upon, but doesn't hurt */
     }
new file mode 100755
--- /dev/null
+++ b/src/installman.sh
@@ -0,0 +1,108 @@
+#! /bin/sh
+# installman.sh --- install or uninstall manpages for Vim
+#
+# arguments:
+# 1  what: "install", "uninstall" or "xxd"
+# 2  target directory                      e.g., "/usr/local/man/it/man1"
+# 3  language addition			   e.g., "" or "-it"
+# 4  vim location as used in manual pages  e.g., "/usr/local/share/vim"
+# 5  runtime dir for menu.vim et al.       e.g., "/usr/local/share/vim/vim70"
+# 6  runtime dir for global vimrc file     e.g., "/usr/local/share/vim"
+# 7  source dir for help files             e.g., "../runtime/doc"
+# 8  mode bits for manpages                e.g., "644"
+# 9  vim exe name                          e.g., "vim"
+# 10 name of vimdiff exe                   e.g., "vimdiff"
+# 11 name of evim exe                      e.g., "evim"
+
+errstatus=0
+
+what=$1
+destdir=$2
+langadd=$3
+vimloc=$4
+scriptloc=$5
+vimrcloc=$6
+helpsource=$7
+manmod=$8
+exename=$9
+vimdiffname=${10}
+evimname=${11}
+
+helpsubloc=$scriptloc/doc
+synsubloc=$scriptloc/syntax
+tutorsubloc=$scriptloc/tutor
+
+if test $what = "install" -o $what = "xxd"; then
+   if test ! -d $destdir; then
+      echo creating $destdir
+      ./mkinstalldirs $destdir
+   fi
+fi
+
+if test $what = "install"; then
+   # vim.1
+   echo installing $destdir/$exename.1
+   sed -e s+/usr/local/lib/vim+$vimloc+ \
+	   -e s+$vimloc/doc+$helpsubloc+ \
+	   -e s+$vimloc/syntax+$synsubloc+ \
+	   -e s+$vimloc/tutor+$tutorsubloc+ \
+	   -e s+$vimloc/vimrc+$vimrcloc/vimrc+ \
+	   -e s+$vimloc/gvimrc+$vimrcloc/gvimrc+ \
+	   -e s+$vimloc/menu.vim+$scriptloc/menu.vim+ \
+	   -e s+$vimloc/bugreport.vim+$scriptloc/bugreport.vim+ \
+	   -e s+$vimloc/filetype.vim+$scriptloc/filetype.vim+ \
+	   -e s+$vimloc/ftoff.vim+$scriptloc/ftoff.vim+ \
+	   -e s+$vimloc/scripts.vim+$scriptloc/scripts.vim+ \
+	   -e s+$vimloc/optwin.vim+$scriptloc/optwin.vim+ \
+	   -e 's+$vimloc/\*.ps+$scriptloc/\*.ps+' \
+	   $helpsource/vim$langadd.1 > $destdir/$exename.1
+   chmod $manmod $destdir/$exename.1
+
+   # vimtutor.1
+   echo installing $destdir/$exename""tutor.1
+   sed -e s+/usr/local/lib/vim+$vimloc+ \
+	   -e s+$vimloc/tutor+$tutorsubloc+ \
+	   $helpsource/vimtutor$langadd.1 > $destdir/$exename""tutor.1
+   chmod $manmod $destdir/$exename""tutor.1
+
+   # vimdiff.1
+   echo installing $destdir/$vimdiffname.1
+   cp $helpsource/vimdiff$langadd.1 $destdir/$vimdiffname.1
+   chmod $manmod $destdir/$vimdiffname.1
+
+   # evim.1
+   echo installing $destdir/$evimname.1
+   sed -e s+/usr/local/lib/vim+$vimloc+ \
+	   $helpsource/evim$langadd.1 > $destdir/$evimname.1
+   chmod $manmod $destdir/$evimname.1
+fi
+
+if test $what = "uninstall"; then
+   echo Checking for Vim manual pages in $destdir...
+   if test -r $destdir/$exename.1; then
+      echo deleting $destdir/$exename.1
+      rm -f $destdir/$exename.1
+   fi
+   if test -r $destdir/$exename""tutor.1; then
+      echo deleting $destdir/$exename""tutor.1
+      rm -f $destdir/$exename""tutor.1
+   fi
+   if test -r $destdir/$vimdiffname.1; then
+      echo deleting $destdir/$vimdiffname.1
+      rm -f $destdir/$vimdiffname.1
+   fi
+   if test -r $destdir/$evimname.1; then
+      echo deleting $destdir/$evimname.1
+      rm -f $destdir/$evimname.1
+   fi
+fi
+
+if test $what = "xxd"; then
+   echo installing $destdir/xxd.1
+   cp $helpsource/xxd$langadd.1 $destdir/xxd.1
+   chmod $manmod $destdir/xxd.1
+fi
+
+exit $errstatus
+
+# vim: set sw=3 :
new file mode 100644
--- /dev/null
+++ b/src/installml.sh
@@ -0,0 +1,162 @@
+#! /bin/sh
+# installml.sh --- install or uninstall manpage links for Vim
+#
+# arguments:
+# 1  what: "install" or "uninstall"
+# 2  also do GUI pages: "yes" or ""
+# 3  target directory                e.g., "/usr/local/man/it/man1"
+# 4  vim exe name                    e.g., "vim"
+# 5  vimdiff exe name                e.g., "vimdiff"
+# 6  evim exe name                   e.g., "evim"
+# 7  ex exe name                     e.g., "ex"
+# 8  view exe name                   e.g., "view"
+# 9  rvim exe name                   e.g., "rvim"
+# 10 rview exe name                  e.g., "rview"
+# 11 gvim exe name                   e.g., "gvim"
+# 12 gview exe name                  e.g., "gview"
+# 13 rgvim exe name                  e.g., "rgvim"
+# 14 rgview exe name                 e.g., "rgview"
+# 15 gvimdiff exe name               e.g., "gvimdiff"
+# 16 eview exe name                  e.g., "eview"
+
+errstatus=0
+
+what=$1
+gui=$2
+destdir=$3
+vimname=$4
+vimdiffname=$5
+evimname=$6
+exname=$7
+viewname=$8
+rvimname=$9
+rviewname=${10}
+gvimname=${11}
+gviewname=${12}
+rgvimname=${13}
+rgviewname=${14}
+gvimdiffname=${15}
+eviewname=${16}
+
+if test $what = "install"; then
+   if test ! -d $destdir; then
+      echo creating $destdir
+      ./mkinstalldirs $destdir
+   fi
+
+   # ex
+   if test ! -e $destdir/$exname.1; then
+      echo creating link $destdir/$exname.1
+      cd $destdir; ln -s $vimname.1 $exname.1
+   fi
+
+   # view
+   if test ! -e $destdir/$viewname.1; then
+      echo creating link $destdir/$viewname.1
+      cd $destdir; ln -s $vimname.1 $viewname.1
+   fi
+
+   # rvim
+   if test ! -e $destdir/$rvimname.1; then
+      echo creating link $destdir/$rvimname.1
+      cd $destdir; ln -s $vimname.1 $rvimname.1
+   fi
+
+   # rview
+   if test ! -e $destdir/$rviewname.1; then
+      echo creating link $destdir/$rviewname.1
+      cd $destdir; ln -s $vimname.1 $rviewname.1
+   fi
+
+   # GUI targets are optional
+   if test "$gui" = "yes"; then
+      # gvim
+      if test ! -e $destdir/$gvimname.1; then
+	 echo creating link $destdir/$gvimname.1
+	 cd $destdir; ln -s $vimname.1 $gvimname.1
+      fi
+
+      # gview
+      if test ! -e $destdir/$gviewname.1; then
+	 echo creating link $destdir/$gviewname.1
+	 cd $destdir; ln -s $vimname.1 $gviewname.1
+      fi
+
+      # rgvim
+      if test ! -e $destdir/$rgvimname.1; then
+	 echo creating link $destdir/$rgvimname.1
+	 cd $destdir; ln -s $vimname.1 $rgvimname.1
+      fi
+
+      # rgview
+      if test ! -e $destdir/$rgviewname.1; then
+	 echo creating link $destdir/$rgviewname.1
+	 cd $destdir; ln -s $vimname.1 $rgviewname.1
+      fi
+
+      # gvimdiff
+      if test ! -e $destdir/$gvimdiffname.1; then
+	 echo creating link $destdir/$gvimdiffname.1
+	 cd $destdir; ln -s $vimdiffname.1 $gvimdiffname.1
+      fi
+
+      # eview
+      if test ! -e $destdir/$eviewname.1; then
+	 echo creating link $destdir/$eviewname.1
+	 cd $destdir; ln -s $evimname.1 $eviewname.1
+      fi
+   fi
+fi
+
+if test $what = "uninstall"; then
+   echo Checking for Vim manual page links in $destdir...
+
+   if test -L $destdir/$exname.1; then
+      echo deleting $destdir/$exname.1
+      rm -f $destdir/$exname.1
+   fi
+   if test -L $destdir/$viewname.1; then
+      echo deleting $destdir/$viewname.1
+      rm -f $destdir/$viewname.1
+   fi
+   if test -L $destdir/$rvimname.1; then
+      echo deleting $destdir/$rvimname.1
+      rm -f $destdir/$rvimname.1
+   fi
+   if test -L $destdir/$rviewname.1; then
+      echo deleting $destdir/$rviewname.1
+      rm -f $destdir/$rviewname.1
+   fi
+
+   # GUI targets are optional
+   if test "$gui" = "yes"; then
+      if test -L $destdir/$gvimname.1; then
+	 echo deleting $destdir/$gvimname.1
+	 rm -f $destdir/$gvimname.1
+      fi
+      if test -L $destdir/$gviewname.1; then
+	 echo deleting $destdir/$gviewname.1
+	 rm -f $destdir/$gviewname.1
+      fi
+      if test -L $destdir/$rgvimname.1; then
+	 echo deleting $destdir/$rgvimname.1
+	 rm -f $destdir/$rgvimname.1
+      fi
+      if test -L $destdir/$rgviewname.1; then
+	 echo deleting $destdir/$rgviewname.1
+	 rm -f $destdir/$rgviewname.1
+      fi
+      if test -L $destdir/$gvimdiffname.1; then
+	 echo deleting $destdir/$gvimdiffname.1
+	 rm -f $destdir/$gvimdiffname.1
+      fi
+      if test -L $destdir/$eviewname.1; then
+	 echo deleting $destdir/$eviewname.1
+	 rm -f $destdir/$eviewname.1
+      fi
+   fi
+fi
+
+exit $errstatus
+
+# vim: set sw=3 :
--- a/src/main.c
+++ b/src/main.c
@@ -3113,13 +3113,13 @@ build_drop_cmd(filec, filev, sendReply)
     for (i = 0; i < filec; i++)
     {
 	/* On Unix the shell has already expanded the wildcards, don't want to
-	 * do it again in the Vim server.  On MS-Windows only need to escape a
-	 * space. */
+	 * do it again in the Vim server.  On MS-Windows only escape
+	 * non-wildcard characters. */
 	p = vim_strsave_escaped((char_u *)filev[i],
 #ifdef UNIX
 		PATH_ESC_CHARS
 #else
-		(char_u *)" "
+		(char_u *)" \t%#"
 #endif
 		);
 	if (p == NULL)
--- a/src/normal.c
+++ b/src/normal.c
@@ -7342,7 +7342,11 @@ nv_g_cmd(cap)
 	    {
 		i = curwin->w_leftcol + W_WIDTH(curwin) - col_off - 1;
 		coladvance((colnr_T)i);
-		curwin->w_set_curswant = TRUE;
+
+		/* Make sure we stick in this column. */
+		validate_virtcol();
+		curwin->w_curswant = curwin->w_virtcol;
+		curwin->w_set_curswant = FALSE;
 	    }
 	}
 	break;
--- a/src/option.c
+++ b/src/option.c
@@ -118,6 +118,7 @@ typedef enum
     , PV_SCBIND
     , PV_SCROLL
     , PV_SI
+    , PV_STL
     , PV_SN
     , PV_STS
     , PV_SUA
@@ -2024,7 +2025,7 @@ static struct vimoption
 			    {(char_u *)TRUE, (char_u *)0L}},
     {"statusline"  ,"stl",  P_STRING|P_VI_DEF|P_ALLOCED|P_RSTAT,
 #ifdef FEAT_STL_OPT
-			    (char_u *)&p_stl, PV_NONE,
+			    (char_u *)&p_stl, OPT_BOTH(PV_STL),
 #else
 			    (char_u *)NULL, PV_NONE,
 #endif
@@ -2315,6 +2316,15 @@ static struct vimoption
     {"wildmode",    "wim",  P_STRING|P_VI_DEF|P_COMMA|P_NODUP,
 			    (char_u *)&p_wim, PV_NONE,
 			    {(char_u *)"full", (char_u *)0L}},
+    {"wildoptions", "wop",  P_STRING|P_VI_DEF,
+#ifdef FEAT_CMDL_COMPL
+			    (char_u *)&p_wop, PV_NONE,
+			    {(char_u *)"", (char_u *)0L}
+#else
+			    (char_u *)NULL, PV_NONE,
+			    {(char_u *)NULL, (char_u *)0L}
+#endif
+			    },
     {"winaltkeys",  "wak",  P_STRING|P_VI_DEF,
 #ifdef FEAT_WAK
 			    (char_u *)&p_wak, PV_NONE,
@@ -2465,6 +2475,9 @@ static char *(p_ambw_values[]) = {"singl
 static char *(p_bg_values[]) = {"light", "dark", NULL};
 static char *(p_nf_values[]) = {"octal", "hex", "alpha", NULL};
 static char *(p_ff_values[]) = {FF_UNIX, FF_DOS, FF_MAC, NULL};
+#ifdef FEAT_CMDL_COMPL
+static char *(p_wop_values[]) = {"tagfile", NULL};
+#endif
 #ifdef FEAT_WAK
 static char *(p_wak_values[]) = {"yes", "menu", "no", NULL};
 #endif
@@ -4909,6 +4922,15 @@ did_set_string_option(opt_idx, varp, new
 	    errmsg = e_invarg;
     }
 
+#ifdef FEAT_CMDL_COMPL
+    /* 'wildoptions' */
+    else if (varp == &p_wop)
+    {
+	if (check_opt_strings(p_wop, p_wop_values, TRUE) != OK)
+	    errmsg = e_invarg;
+    }
+#endif
+
 #ifdef FEAT_WAK
     /* 'winaltkeys' */
     else if (varp == &p_wak)
@@ -5563,7 +5585,7 @@ did_set_string_option(opt_idx, varp, new
 
 #ifdef FEAT_STL_OPT
     /* 'statusline' or 'rulerformat' */
-    else if (varp == &p_stl || varp == &p_ruf)
+    else if (gvarp == &p_stl || varp == &p_ruf)
     {
 	int wid;
 
@@ -5583,7 +5605,7 @@ did_set_string_option(opt_idx, varp, new
 	}
 	else
 	    errmsg = check_stl_option(s);
-	if (varp == &(p_ruf) && errmsg == NULL)
+	if (varp == &p_ruf && errmsg == NULL)
 	    comp_col();
     }
 #endif
@@ -7915,6 +7937,9 @@ get_varp_scope(p, opt_flags)
 	    case OPT_BOTH(PV_DICT): return (char_u *)&(curbuf->b_p_dict);
 	    case OPT_BOTH(PV_TSR):  return (char_u *)&(curbuf->b_p_tsr);
 #endif
+#ifdef FEAT_STL_OPT
+	    case OPT_BOTH(PV_STL):  return (char_u *)&(curwin->w_p_stl);
+#endif
 	}
 	return NULL; /* "cannot happen" */
     }
@@ -7967,6 +7992,10 @@ get_varp(p)
 	case OPT_BOTH(PV_EFM):	return *curbuf->b_p_efm != NUL
 				    ? (char_u *)&(curbuf->b_p_efm) : p->var;
 #endif
+#ifdef FEAT_STL_OPT
+	case OPT_BOTH(PV_STL):  return *curwin->w_p_stl != NUL
+				    ? (char_u *)&(curwin->w_p_stl) : p->var;
+#endif
 
 #ifdef FEAT_ARABIC
 	case PV_ARAB:	return (char_u *)&(curwin->w_p_arab);
@@ -8168,6 +8197,9 @@ copy_winopt(from, to)
     to->wo_rl  = from->wo_rl;
     to->wo_rlc = vim_strsave(from->wo_rlc);
 #endif
+#ifdef FEAT_STL_OPT
+    to->wo_stl = vim_strsave(from->wo_stl);
+#endif
     to->wo_wrap = from->wo_wrap;
 #ifdef FEAT_LINEBREAK
     to->wo_lbr = from->wo_lbr;
@@ -8226,6 +8258,9 @@ check_winopt(wop)
 #ifdef FEAT_RIGHTLEFT
     check_string_option(&wop->wo_rlc);
 #endif
+#ifdef FEAT_STL_OPT
+    check_string_option(&wop->wo_stl);
+#endif
 }
 
 /*
@@ -8248,6 +8283,9 @@ clear_winopt(wop)
 #ifdef FEAT_RIGHTLEFT
     clear_string_option(&wop->wo_rlc);
 #endif
+#ifdef FEAT_STL_OPT
+    clear_string_option(&wop->wo_stl);
+#endif
 }
 
 /*
--- a/src/option.h
+++ b/src/option.h
@@ -785,6 +785,9 @@ static char *(p_ve_values[]) = {"block",
 #endif
 EXTERN long	p_verbose;	/* 'verbose' */
 EXTERN int	p_warn;		/* 'warn' */
+#ifdef FEAT_CMDL_COMPL
+EXTERN char_u	*p_wop;		/* 'wildoptions' */
+#endif
 #if defined(FEAT_GUI_MSWIN) || defined(FEAT_GUI_MOTIF) || defined(LINT) \
 	|| defined (FEAT_GUI_GTK) || defined(FEAT_GUI_PHOTON) || defined(FEAT_GUI_KDE)
 #define FEAT_WAK
--- a/src/proto/ex_cmds.pro
+++ b/src/proto/ex_cmds.pro
@@ -42,6 +42,8 @@ char_u *check_help_lang __ARGS((char_u *
 int help_heuristic __ARGS((char_u *matched_string, int offset, int wrong_case));
 int find_help_tags __ARGS((char_u *arg, int *num_matches, char_u ***matches, int keep_lang));
 void fix_help_buffer __ARGS((void));
+void ex_exusage __ARGS((exarg_T *eap));
+void ex_viusage __ARGS((exarg_T *eap));
 void ex_helptags __ARGS((exarg_T *eap));
 void ex_sign __ARGS((exarg_T *eap));
 void sign_gui_started __ARGS((void));
--- a/src/proto/fileio.pro
+++ b/src/proto/fileio.pro
@@ -20,6 +20,7 @@ void write_lnum_adjust __ARGS((linenr_T 
 void vim_deltempdir __ARGS((void));
 char_u *vim_tempname __ARGS((int extra_char));
 void forward_slash __ARGS((char_u *fname));
+void aubuflocal_remove __ARGS((buf_T *buf));
 void do_augroup __ARGS((char_u *arg, int del_group));
 int check_ei __ARGS((void));
 void do_autocmd __ARGS((char_u *arg, int forceit));
@@ -30,7 +31,7 @@ void aucmd_restbuf __ARGS((aco_save_T *a
 int apply_autocmds __ARGS((EVENT_T event, char_u *fname, char_u *fname_io, int force, buf_T *buf));
 int apply_autocmds_retval __ARGS((EVENT_T event, char_u *fname, char_u *fname_io, int force, buf_T *buf, int *retval));
 int has_cursorhold __ARGS((void));
-int has_autocmd __ARGS((EVENT_T event, char_u *sfname));
+int has_autocmd __ARGS((EVENT_T event, char_u *sfname, buf_T *buf));
 char_u *get_augroup_name __ARGS((expand_T *xp, int idx));
 char_u *set_context_in_autocmd __ARGS((expand_T *xp, char_u *arg, int doautocmd));
 char_u *get_event_name __ARGS((expand_T *xp, int idx));
--- a/src/screen.c
+++ b/src/screen.c
@@ -700,7 +700,7 @@ updateWindow(wp)
 	    || p_ru
 # endif
 # ifdef FEAT_STL_OPT
-	    || *p_stl
+	    || *p_stl != NUL || *wp->w_p_stl != NUL
 # endif
 	    )
 	win_redr_status(wp);
@@ -5040,7 +5040,7 @@ win_redr_status(wp)
 	wp->w_redr_status = TRUE;
     }
 #ifdef FEAT_STL_OPT
-    else if (*p_stl)
+    else if (*p_stl != NUL || *wp->w_p_stl != NUL)
     {
 	/* redraw custom status line */
 	win_redr_custom(wp, FALSE);
@@ -5276,7 +5276,10 @@ win_redr_custom(wp, Ruler)
     row = W_WINROW(wp) + wp->w_height;
     fillchar = fillchar_status(&attr, wp == curwin);
     maxwidth = W_WIDTH(wp);
-    p = p_stl;
+    if (*wp->w_p_stl != NUL)
+	p = wp->w_p_stl;
+    else
+	p = p_stl;
     if (Ruler)
     {
 	p = p_ruf;
@@ -8214,7 +8217,7 @@ showruler(always)
     if (!always && !redrawing())
 	return;
 #if defined(FEAT_STL_OPT) && defined(FEAT_WINDOWS)
-    if (*p_stl && curwin->w_status_height)
+    if ((*p_stl != NUL || *curwin->w_p_stl != NUL) && curwin->w_status_height)
 	win_redr_custom(curwin, FALSE);
     else
 #endif
--- a/src/structs.h
+++ b/src/structs.h
@@ -189,6 +189,10 @@ typedef struct
 #endif
     long	wo_scr;
 #define w_p_scr w_onebuf_opt.wo_scr	/* 'scroll' */
+#ifdef FEAT_STL_OPT
+    char_u	*wo_stl;
+#define w_p_stl w_onebuf_opt.wo_stl	/* 'statusline' */
+#endif
 #ifdef FEAT_SCROLLBIND
     int		wo_scb;
 # define w_p_scb w_onebuf_opt.wo_scb	/* 'scrollbind' */
--- a/src/tag.c
+++ b/src/tag.c
@@ -2862,7 +2862,7 @@ jumpto_tag(lbuf, forceit, keep_help)
      */
     if (mch_getperm(fname) < 0
 #ifdef FEAT_AUTOCMD
-	    && !has_autocmd(EVENT_BUFREADCMD, fname)
+	    && !has_autocmd(EVENT_BUFREADCMD, fname, NULL)
 #endif
        )
     {
--- a/src/testdir/Make_amiga.mak
+++ b/src/testdir/Make_amiga.mak
@@ -23,7 +23,7 @@ SCRIPTS = test1.out test3.out test4.out 
 		test33.out test34.out test35.out test36.out test37.out \
 		test38.out test39.out test40.out test41.out test42.out \
 		test43.out test44.out test45.out test46.out test47.out \
-		test48.out test51.out test53.out
+		test48.out test51.out test53.out test54.out
 
 .SUFFIXES: .in .out
 
@@ -96,3 +96,4 @@ test47.out: test47.in
 test48.out: test48.in
 test51.out: test51.in
 test53.out: test53.in
+test54.out: test54.in
--- a/src/testdir/Make_dos.mak
+++ b/src/testdir/Make_dos.mak
@@ -17,7 +17,7 @@ SCRIPTS16 =	test1.out test19.out test20.
 		test23.out test24.out test28.out test29.out \
 		test35.out test36.out test43.out \
 		test44.out test45.out test46.out test47.out \
-		test48.out test51.out test53.out
+		test48.out test51.out test53.out test54.out
 
 SCRIPTS =	test3.out test4.out test5.out test6.out test7.out \
 		test8.out test9.out test11.out test13.out test14.out \
--- a/src/testdir/Make_os2.mak
+++ b/src/testdir/Make_os2.mak
@@ -23,7 +23,7 @@ SCRIPTS = test1.out test3.out test4.out 
 		test33.out test34.out test35.out test36.out test37.out \
 		test38.out test39.out test40.out test41.out test42.out \
 		test43.out test44.out test45.out test46.out test47.out \
-		test48.out test51.out test53.out
+		test48.out test51.out test53.out test54.out
 
 .SUFFIXES: .in .out
 
--- a/src/testdir/Make_vms.mms
+++ b/src/testdir/Make_vms.mms
@@ -4,7 +4,7 @@
 # Authors:	Zoltan Arpadffy, <arpadffy@polarhome.com>
 #		Sandor Kopanyi,  <sandor.kopanyi@mailbox.hu>
 #
-# Last change:  2004 Jul 02
+# Last change:  2004 Dec 24
 #
 # This has been tested on VMS 6.2 to 7.2 on DEC Alpha and VAX.
 # Edit the lines in the Configuration section below to select.
@@ -57,7 +57,7 @@ SCRIPT = test1.out  test2.out  test3.out
 	 test33.out test34.out test35.out test36.out test37.out \
 	 test38.out test39.out test40.out test41.out test42.out \
 	 test43.out test44.out test45.out test46.out \
-	 test48.out test51.out test53.out
+	 test48.out test51.out test53.out test54.out
 
 .IFDEF WANT_GUI
 SCRIPT_GUI = test16.out
--- a/src/testdir/Makefile
+++ b/src/testdir/Makefile
@@ -13,7 +13,8 @@ SCRIPTS = test1.out test2.out test3.out 
 		test33.out test34.out test35.out test36.out test37.out \
 		test38.out test39.out test40.out test41.out test42.out \
 		test43.out test44.out test45.out test46.out test47.out \
-		test48.out test49.out test51.out test52.out test53.out
+		test48.out test49.out test51.out test52.out test53.out \
+		test54.out
 
 SCRIPTS_GUI = test16.out
 
new file mode 100644
--- /dev/null
+++ b/src/testdir/test54.in
@@ -0,0 +1,17 @@
+Some tests for buffer-local autocommands
+
+STARTTEST
+:so small.vim
+:e xx
+:!rm -f test.out
+:au BufLeave <buffer> :!echo "buffer-local autommand in %" >> test.out
+:e somefile           " here, autocommand for xx shall write test.out 
+:                     " but autocommand shall not apply to buffer named <buffer>
+:bwipe xx             " here, autocommand shall be auto-deleted
+:e xx                 " nothing shall be written
+:e somefile           " nothing shall be written
+:qa!
+ENDTEST
+
+start of test file xx
+end of test file xx
new file mode 100644
--- /dev/null
+++ b/src/testdir/test54.ok
@@ -0,0 +1,1 @@
+buffer-local autommand in xx
--- a/src/version.h
+++ b/src/version.h
@@ -36,5 +36,5 @@
 #define VIM_VERSION_NODOT	"vim70aa"
 #define VIM_VERSION_SHORT	"7.0aa"
 #define VIM_VERSION_MEDIUM	"7.0aa ALPHA"
-#define VIM_VERSION_LONG	"VIM - Vi IMproved 7.0aa ALPHA (2004 Dec 17)"
-#define VIM_VERSION_LONG_DATE	"VIM - Vi IMproved 7.0aa ALPHA (2004 Dec 17, compiled "
+#define VIM_VERSION_LONG	"VIM - Vi IMproved 7.0aa ALPHA (2004 Dec 24)"
+#define VIM_VERSION_LONG_DATE	"VIM - Vi IMproved 7.0aa ALPHA (2004 Dec 24, compiled "