changeset 464:3b705e71c7b0 v7.0124

updated for version 7.0124
author vimboss
date Fri, 05 Aug 2005 21:35:02 +0000
parents 8411e13e6dcb
children 49669e1a7c5c
files runtime/doc/eval.txt runtime/doc/options.txt runtime/doc/pi_netrw.txt runtime/doc/tags runtime/doc/todo.txt runtime/doc/version7.txt runtime/plugin/netrw.vim runtime/syntax/sh.vim runtime/syntax/vim.vim src/edit.c src/eval.c src/proto/edit.pro src/search.c src/tag.c src/version.h
diffstat 15 files changed, 479 insertions(+), 285 deletions(-) [+]
line wrap: on
line diff
--- a/runtime/doc/eval.txt
+++ b/runtime/doc/eval.txt
@@ -1,4 +1,4 @@
-*eval.txt*      For Vim version 7.0aa.  Last change: 2005 Aug 01
+*eval.txt*      For Vim version 7.0aa.  Last change: 2005 Aug 05
 
 
 		  VIM REFERENCE MANUAL    by Bram Moolenaar
@@ -1474,6 +1474,8 @@ call( {func}, {arglist} [, {dict}])
 char2nr( {expr})		Number	ASCII value of first char in {expr}
 cindent( {lnum})		Number	C indent for line {lnum}
 col( {expr})			Number	column nr of cursor or mark
+complete_add( {expr})		Number	add completion match
+complete_check()		Number  check for key typed during completion
 confirm( {msg} [, {choices} [, {default} [, {type}]]])
 				Number	number of choice picked by user
 copy( {expr})			any	make a shallow copy of {expr}
@@ -1886,6 +1888,22 @@ col({expr})	The result is a Number, whic
 				\<C-O>:echo col(".") . "\n" <Bar>
 				\let &ve = save_ve<CR>
 <
+
+complete_add({expr})				*complete_add()*
+		Add {expr} to the list of matches.  Only to be used by the
+		function specified with the 'completefunc' option.
+		Returns 0 for failure (empty string or out of memory),
+		1 when the match was added, 2 when the match was already in
+		the list.
+
+complete_check()				*complete_check()*
+		Check for a key typed while looking for completion matches.
+		This is to be used when looking for matches takes some time.
+		Returns non-zero when searching for matches is to be aborted,
+		zero otherwise.
+		Only to be used by the function specified with the
+		'completefunc' option.
+
 						*confirm()*
 confirm({msg} [, {choices} [, {default} [, {type}]]])
 		Confirm() offers the user a dialog, from which a choice can be
@@ -5233,8 +5251,8 @@ 7. Commands						*expression-commands*
 			value of each item.
 			When an error is detected for a command inside the
 			loop, execution continues after the "endfor".
-			Changing {list} affects what items are used.  Make a
-			copy if this is unwanted: >
+			Changing {list} inside the loop affects what items are
+			used.  Make a copy if this is unwanted: >
 				:for item in copy(mylist)
 <			When not making a copy, Vim stores a reference to the
 			next item in the list, before executing the commands
@@ -5252,12 +5270,6 @@ 7. Commands						*expression-commands*
 			changing.  Unlet the variable at the end of the loop
 			to allow multiple item types.
 
-:for {var} in {string}
-:endfo[r]		Like ":for" above, but use each character in {string}
-			as a list item.
-			Composing characters are used as separate characters.
-			A Number is first converted to a String.
-
 :for [{var1}, {var2}, ...] in {listlist}
 :endfo[r]
 			Like ":for" above, but each item in {listlist} must be
--- a/runtime/doc/options.txt
+++ b/runtime/doc/options.txt
@@ -1,4 +1,4 @@
-*options.txt*	For Vim version 7.0aa.  Last change: 2005 Aug 01
+*options.txt*	For Vim version 7.0aa.  Last change: 2005 Aug 05
 
 
 		  VIM REFERENCE MANUAL	  by Bram Moolenaar
@@ -1607,7 +1607,15 @@ A jump table for the options with a shor
 	with the matching words.  These matches should include the "a:base"
 	text.  When there are no matches return an empty List.
 
+	When searching for matches takes some time call |complete_add()| to
+	add each match to the total list.  These matches should then not
+	appear in the returned list!  Call |complete_check()| now and then to
+	allow the user to press a key while still searching for matches.  Stop
+	searching when it returns non-zero.
+
 	The function must not move the cursor!
+	This option cannot be set from a |modeline| or in the |sandbox|, for
+	security reasons.
 
 	An example that completes the names of the months: >
 		fun! CompleteMonths(findstart, col, base)
@@ -1632,6 +1640,32 @@ A jump table for the options with a shor
 		endfun
 		set completefunc=CompleteMonths
 <
+	The same, but now pretending searching for matches is slow: >
+		fun! CompleteMonths(findstart, col, base)
+		  if a:findstart
+		    " locate the start of the word
+		    let line = getline('.')
+		    let start = a:col
+		    while start > 0 && line[start - 1] =~ '\a'
+		      let start -= 1
+		    endwhile
+		    return start
+		  else
+		    " find months matching with "a:base"
+		    for m in split("Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec")
+		      if m =~ '^' . a:base
+			call complete_add(m)
+		      endif
+		      sleep 300m	" simulate searching for next match
+		      if complete_check()
+			break
+		      endif
+		    endfor
+		    return []
+		  endif
+		endfun
+		set completefunc=CompleteMonths
+<
 
 				*'confirm'* *'cf'* *'noconfirm'* *'nocf'*
 'confirm' 'cf'		boolean (default off)
--- a/runtime/doc/pi_netrw.txt
+++ b/runtime/doc/pi_netrw.txt
@@ -1,4 +1,4 @@
-*pi_netrw.txt*  For Vim version 7.0.  Last change: Aug 01, 2005
+*pi_netrw.txt*  For Vim version 7.0.  Last change: Aug 04, 2005
 
 
 		VIM REFERENCE MANUAL    by Charles E. Campbell, Jr.
@@ -584,6 +584,8 @@ MAPS   								*netrw-maps*
      :Sexplore[!] [dir].Split & Explore directory of current file|netrw-explore|
      :Hexplore[!] [dir].Horizontal Split & Explore...............|netrw-explore|
      :Vexplore[!] [dir].Vertical Split & Explore.................|netrw-explore|
+     :Pexplore[!] [dir].Vertical Split & Explore.................|netrw-explore|
+     :Nexplore[!] [dir].Vertical Split & Explore.................|netrw-explore|
 
 QUICK REFERENCE COMMANDS TABLE     			*netrw-browse-cmds*
 >
@@ -606,6 +608,7 @@ QUICK REFERENCE COMMANDS TABLE     			*n
 	 <c-l>	Causes Netrw to refresh the directory listing
 	   o	Enter the file/directory under the cursor in a new browser
 	   	window.  A horizontal split is used.
+	   p	Preview the file
 	   r	Reverse sorting order
 	   s	Select sorting style: by name, time, or file size
 	   v	Enter the file/directory under the cursor in a new browser
@@ -741,10 +744,12 @@ ssh interaction, etc, see |netrw-list-ha
 
 DIRECTORY EXPLORING COMMANDS						*netrw-explore*
 
-     :Explore[!]   [dir].Explore directory of current file
-     :Sexplore[!]  [dir].Split & Explore directory of current file
-     :Hexplore[!]  [dir].Horizontal Split & Explore
-     :Vexplore[!]  [dir].Vertical Split & Explore
+     :Explore[!]   [dir]... Explore directory of current file
+     :Sexplore[!]  [dir]... Split & Explore directory of current file
+     :Hexplore[!]  [dir]... Horizontal Split & Explore
+     :Vexplore[!]  [dir]... Vertical Split & Explore
+     :Nexplore............. used with **/patterns; go to next matching file
+     :Pexplore............. used with **/patterns; go to previous matching file
 
 The Explore command will open the local-directory browser on the current
 file's directory (or on directory [dir] if specified).  The window
@@ -762,6 +767,23 @@ optional ! does the Explore with |abovel
 Vexplore does an Explore with |leftabove| vertical splitting; the optiona
 ! does an Explore with |topleft| vertical splitting.
 
+(Following needs v7.0 or later)
+When Explore, Sexplore, Hexplore, or Vexplore are used with
+**/filename-patterns, netrw will attempt to find a (sub)directory which
+matches the filename pattern.  The Nexplore and Pexplore commands enable
+one to proceed to the next/previous matching file, respectively.  If your
+console or gui produce recognizable shift-up or shift-down sequences, then
+
+	<s-down>  == Nexplore, and
+	<s-up>    == Pexplore.
+
+As an example, consider >
+
+	:Explore **/*.c
+	:Nexplore
+	:Nexplore
+	:Pexplore
+<
 
 REFRESHING THE LISTING					*netrw-ctrl-l*
 
@@ -993,10 +1015,10 @@ the current directory to the current bro
 
 BOOKMARKING A DIRECTORY		*netrw-b* *netrw-bookmark* *netrw-bookmarks*
 
-One may easily "bookmark" a directory by using
+One may easily "bookmark" a directory by using >
 
 	{cnt}b
-
+<
 Any count may be used.  One may use viminfo's "!" option to retain bookmarks
 between vim sessions.  See |netrw-B| for how to return to a bookmark and
 |netrw-q| for how to list them.
@@ -1143,6 +1165,21 @@ which is loaded automatically at startup
 ==============================================================================
 10. History						*netrw-history*
 
+	v58: * Explore and relatives can now handle **/somefilepattern (v7)
+	     * Nexplore and Pexplore introduced (v7).  shift-down and shift-up
+	       cursor keys will invoke Nexplore and Pexplore, respectively.
+	     * bug fixed with o and v
+	     * autochdir only worked around for vim when it has been
+	       compiled with either |+netbeans_intg| or |+sun_workshop|
+	     * Under Windows, all directories and files were being preceded
+	       with a "/" when local browsing.  Fixed.
+	     * When: syntax highlighting is off, laststatus=2, and remote
+	       browsing is used, sometimes the laststatus highlighting
+	       bleeds into the entire display.  Work around - do an extra
+	       redraw in that case.
+	     * Bugfix: when g:netrw_keepdir=0, due to re-use of buffers,
+	       netrw didn't change the directory when it should've
+	     * Bugfix: D and R commands work again
 	v57: * Explore and relatives can now handle RO files
 	     * reverse sort restored with vim7's sort command
 	     * g:netrw_keepdir now being used to keep the current directory
--- a/runtime/doc/tags
+++ b/runtime/doc/tags
@@ -4456,6 +4456,8 @@ compl-occult	insert.txt	/*compl-occult*
 compl-tag	insert.txt	/*compl-tag*
 compl-vim	insert.txt	/*compl-vim*
 compl-whole-line	insert.txt	/*compl-whole-line*
+complete_add()	eval.txt	/*complete_add()*
+complete_check()	eval.txt	/*complete_check()*
 complex-change	change.txt	/*complex-change*
 complex-repeat	repeat.txt	/*complex-repeat*
 compress	pi_gzip.txt	/*compress*
@@ -5163,6 +5165,7 @@ hebrew	hebrew.txt	/*hebrew*
 hebrew.txt	hebrew.txt	/*hebrew.txt*
 help	various.txt	/*help*
 help-context	help.txt	/*help-context*
+help-tags	tags	1
 help-translated	various.txt	/*help-translated*
 help-xterm-window	various.txt	/*help-xterm-window*
 help.txt	help.txt	/*help.txt*
--- a/runtime/doc/todo.txt
+++ b/runtime/doc/todo.txt
@@ -1,4 +1,4 @@
-*todo.txt*      For Vim version 7.0aa.  Last change: 2005 Aug 02
+*todo.txt*      For Vim version 7.0aa.  Last change: 2005 Aug 05
 
 
 		  VIM REFERENCE MANUAL	  by Bram Moolenaar
@@ -66,8 +66,6 @@ PLANNED FOR VERSION 7.0:
     make it work for all completion methods.
 
     First cleanup the Insert-mode completion.
-    - check security of 'completefunc'.
-    - use callback to interrupt searching for matches.
 
     UI:
     - At first: use 'wildmenu' kind of thing.
@@ -76,7 +74,8 @@ PLANNED FOR VERSION 7.0:
       alternatives).
 
     Completion logic:
-	Use 'coupler' option to list items that connect words.  For C: ".,->".
+	Use something like 'completefunc'?
+	runtime/complete/{filetype}.vim files?
 	In function arguments suggest variables of expected type.
 
 	Ideas from others:
@@ -102,7 +101,7 @@ PLANNED FOR VERSION 7.0:
 	"Visual Assist" http://www.wholetomato.com/products:
 	Completion in .NET framework SharpDevelop: http://www.icsharpcode.net
 
-    - Pre-expand abbreviations, show which abbrevs would match?
+        - Pre-expand abbreviations, show which abbrevs would match?
 
 -   UNDO TREE: keep all states of the text, don't delete undo info.
     When making a change, instead of clearing any future undo (thus redo)
--- a/runtime/doc/version7.txt
+++ b/runtime/doc/version7.txt
@@ -1,4 +1,4 @@
-*version7.txt*  For Vim version 7.0aa.  Last change: 2005 Aug 04
+*version7.txt*  For Vim version 7.0aa.  Last change: 2005 Aug 05
 
 
 		  VIM REFERENCE MANUAL    by Bram Moolenaar
@@ -399,6 +399,8 @@ New functions: ~
 |browsedir()|		dialog to select a directory
 |byteidx()| 		index of a character (Ilya Sher)
 |call()|		call a function with List as arguments
+|complete_add()|	add match for 'completefunc'
+|complete_check()|	check for key pressed, for 'completefunc'
 |copy()|		make a shallow copy of a List or Dictionary
 |count()|		count nr of times a value is in a List or Dictionary
 |deepcopy()|		make a full copy of a List or Dictionary
--- a/runtime/plugin/netrw.vim
+++ b/runtime/plugin/netrw.vim
@@ -1,8 +1,16 @@
 " netrw.vim: Handles file transfer and remote directory listing across a network
-" Last Change:	Aug 02, 2005
+" Last Change:	Aug 05, 2005
 " Maintainer:	Charles E Campbell, Jr <drchipNOSPAM at campbellfamily dot biz>
-" Version:	58b	NOT RELEASED
+" Version:	58e	ASTRO-ONLY
 " License:	Vim License  (see vim's :help license)
+" Copyright:    Copyright (C) 1999-2005 Charles E. Campbell, Jr.
+"               Permission is hereby granted to use and distribute this code,
+"               with or without modifications, provided that this copyright
+"               notice is copied with it. Like anything else that's free,
+"               netrw.vim is provided *as is* and comes with no
+"               warranty of any kind, either expressed or implied. In no
+"               event will the copyright holder be liable for any damages
+"               resulting from the use of this software.
 "
 "  But be doers of the Word, and not only hearers, deluding your own selves
 "  (James 1:22 RSV)
@@ -14,7 +22,7 @@
 if exists("g:loaded_netrw") || &cp
   finish
 endif
-let g:loaded_netrw  = "v58b"
+let g:loaded_netrw  = "v58e"
 let loaded_explorer = 1
 let s:keepcpo       = &cpo
 set cpo&vim
@@ -263,15 +271,17 @@ endfun
 " NetRestorePosn: restores the cursor and file position as saved by NetSavePosn() {{{1
 fun! <SID>NetRestorePosn()
 "  call Dfunc("NetRestorePosn() winnr=".s:netrw_winnr." line=".s:netrw_line." col=".s:netrw_col." hline=".s:netrw_hline)
+  let eikeep= &ei
+  set ei=all
 
   " restore window
 "  call Decho("restore window: exe silent! ".s:netrw_winnr."wincmd w")
   exe "silent! ".s:netrw_winnr."wincmd w"
-  if v:shell_error == 0
-   " as suggested by Bram M: redraw on no error
-   " allows protocol error messages to remain visible
-   redraw!
-  endif
+"  if v:shell_error == 0
+"   " as suggested by Bram M: redraw on no error
+"   " allows protocol error messages to remain visible
+"   redraw!
+"  endif
 
   " restore top-of-screen line
 "  call Decho("restore topofscreen: exe norm! ".s:netrw_hline."G0z")
@@ -281,6 +291,7 @@ fun! <SID>NetRestorePosn()
 "  call Decho("restore posn: exe norm! ".s:netrw_line."G0".s:netrw_col."|")
   exe "norm! ".s:netrw_line."G0".s:netrw_col."\<bar>"
 
+  let &ei= eikeep
 "  call Dret("NetRestorePosn")
 endfun
 
@@ -354,7 +365,7 @@ fun! s:NetRead(...)
        let ichoice     = ichoice + 1
        if ichoice > a:0
        	if !exists("g:netrw_quiet")
-         echoerr "***netrw*** Unbalanced string in filename '". wholechoice ."'"
+         echohl Error | echo "***netrw*** Unbalanced string in filename '". wholechoice ."'" | echohl None
          call inputsave()|call input("Press <cr> to continue")|call inputrestore()
 	endif
 "        call Dret("NetRead")
@@ -441,7 +452,7 @@ fun! s:NetRead(...)
      if getline(1) !~ "^$" && !exists("g:netrw_quiet") && getline(1) !~ '^Trying '
       let debugkeep= &debug
       set debug=msg
-      echoerr "***netrw*** ".getline(1)
+      echohl Error | echo "***netrw*** ".getline(1) | echohl None
       call inputsave()|call input("Press <cr> to continue")|call inputrestore()
       let &debug= debugkeep
      endif
@@ -487,7 +498,7 @@ fun! s:NetRead(...)
     if getline(1) !~ "^$"
 "     call Decho("error<".getline(1).">")
      if !exists("g:netrw_quiet")
-      echoerr "***netrw*** ".getline(1)
+      echohl Error | echo "***netrw*** ".getline(1) | echohl None
       call inputsave()|call input("Press <cr> to continue")|call inputrestore()
      endif
     endif
@@ -520,7 +531,7 @@ fun! s:NetRead(...)
 "    call Decho("read via http (method #5)")
     if g:netrw_http_cmd == ""
      if !exists("g:netrw_quiet")
-      echoerr "***netrw*** neither wget nor fetch command is available"
+      echohl Error | echo "***netrw*** neither wget nor fetch command is available" | echohl None
       call inputsave()|call input("Press <cr> to continue")|call inputrestore()
      endif
      exit
@@ -598,7 +609,7 @@ fun! s:NetRead(...)
    elseif     b:netrw_method  == 8	" read with fetch
     if g:netrw_fetch_cmd == ""
      if !exists("g:netrw_quiet")
-      echoerr "***netrw*** fetch command not available"
+      echohl Error | echo "***netrw*** fetch command not available" | echohl None
       call inputsave()|call input("Press <cr> to continue")|call inputrestore()
      endif
      exit
@@ -805,7 +816,7 @@ fun! s:NetWrite(...) range
        let ichoice    = ichoice + 1
        if choice > a:0
        	if !exists("g:netrw_quiet")
-         echoerr "***netrw*** Unbalanced string in filename '". wholechoice ."'"
+         echohl Error | echo "***netrw*** Unbalanced string in filename '". wholechoice ."'" | echohl None
          call inputsave()|call input("Press <cr> to continue")|call inputrestore()
 	endif
 "        call Dret("NetWrite")
@@ -876,7 +887,7 @@ fun! s:NetWrite(...) range
     " If the result of the ftp operation isn't blank, show an error message (tnx to Doug Claar)
     if getline(1) !~ "^$"
      if !exists("g:netrw_quiet")
-      echoerr "***netrw*** ".getline(1)
+      echohl Error | echo "***netrw*** ".getline(1) | echohl None
       call inputsave()|call input("Press <cr> to continue")|call inputrestore()
      endif
      let mod=1
@@ -916,7 +927,7 @@ fun! s:NetWrite(...) range
     " If the result of the ftp operation isn't blank, show an error message (tnx to Doug Claar)
     if getline(1) !~ "^$"
      if  !exists("g:netrw_quiet")
-      echoerr "***netrw*** ".getline(1)
+      echohl Error | echo "***netrw*** ".getline(1) | echohl None
       call inputsave()|call input("Press <cr> to continue")|call inputrestore()
      endif
      let mod=1
@@ -945,7 +956,7 @@ fun! s:NetWrite(...) range
    " http: NetWrite Method #5
    elseif     b:netrw_method == 5
     if !exists("g:netrw_quiet")
-     echoerr "***netrw*** currently <netrw.vim> does not support writing using http:"
+     echohl Error | echo "***netrw*** currently <netrw.vim> does not support writing using http:" | echohl None
      call inputsave()|call input("Press <cr> to continue")|call inputrestore()
     endif
  
@@ -1044,7 +1055,7 @@ fun! <SID>NetBrowse(dirname)
 "   call Decho("b:netrw_method=".b:netrw_method)
    if !executable("ftp")
     if !exists("g:netrw_quiet")
-     echoerr "***netrw*** this system doesn't support remote directory listing via ftp"
+     echohl Error | echo "***netrw*** this system doesn't support remote directory listing via ftp" | echohl None
      call inputsave()|call input("Press <cr> to continue")|call inputrestore()
     endif
 "    call Dret("NetBrowse")
@@ -1052,9 +1063,10 @@ fun! <SID>NetBrowse(dirname)
    endif
   elseif !exists("g:netrw_list_cmd") || g:netrw_list_cmd == ''
    if !exists("g:netrw_quiet")
-    echoerr "***netrw*** this system doesn't support remote directory listing via ssh"
+    echohl Error | echo "***netrw*** this system doesn't support remote directory listing via ssh" | echohl None
     call inputsave()|call input("Press <cr> to continue")|call inputrestore()
    endif
+
 "   call Dret("NetBrowse")
    return
   endif
@@ -1068,7 +1080,7 @@ fun! <SID>NetBrowse(dirname)
 "  call Decho("dirpat<".dirpat.">")
   if dirname !~ dirpat
    if !exists("g:netrw_quiet")
-    echoerr "***netrw*** netrw doesn't understand your dirname<".dirname.">"
+    echohl Error | echo "***netrw*** netrw doesn't understand your dirname<".dirname.">" | echohl None
     call inputsave()|call input("Press <cr> to continue")|call inputrestore()
    endif
 "   call Dret("NetBrowse : badly formatted dirname<".dirname.">")
@@ -1100,7 +1112,7 @@ fun! <SID>NetBrowse(dirname)
 
   " optionally sort by time (-t) or by size (-S)
   if listcmd == "dir" && g:netrw_sort_by =~ "^[ts]"
-   echoerr "***netrw*** windows' ftp doesn't support time/size sorts (get cygwin, set g:netrw_cygwin)"
+   echohl WarningMsg | echo "***netrw*** windows' ftp doesn't support time/size sorts (get cygwin, set g:netrw_cygwin)" | echohl None
    call inputsave()|call input("Press <cr> to continue")|call inputrestore()
   else
    if g:netrw_sort_by =~ "^t"
@@ -1140,7 +1152,8 @@ fun! <SID>NetBrowse(dirname)
    silent call s:NetRead(method."://".user.machine."/".path)
    exe "silent doau BufReadPost ".fname
    keepjumps 1d
-   setlocal nomod
+
+   setlocal nonu nomod noma
 
 "   call Dret("NetBrowse : file<".fname.">")
    return
@@ -1180,7 +1193,7 @@ fun! <SID>NetBrowse(dirname)
   " set up buffer-local mappings
 "  call Decho("set up buffer-local mappings")
   nnoremap <buffer> <silent> <cr>	:exe "norm! 0"<bar>call <SID>NetBrowse(<SID>NetBrowseChgDir(expand("%"),<SID>NetGetWord()))<cr>
-  nnoremap <buffer> <silent> <c-l>	:exe "norm! 0"<bar>call <SID>NetBrowse(<SID>NetBrowseChgDir(expand("%"),'./'))<cr>
+  nnoremap <buffer> <silent> <c-l>	:call <SID>NetRefresh(<SID>NetBrowseChgDir(expand("%"),'./'))<cr>
   nnoremap <buffer> <silent> -		:exe "norm! 0"<bar>call <SID>NetBrowse(<SID>NetBrowseChgDir(expand("%"),'../'))<cr>
   nnoremap <buffer> <silent> a		:let g:netrw_hide=(g:netrw_hide+1)%3<bar>exe "norm! 0"<bar>call <SID>NetBrowse(<SID>NetBrowseChgDir(expand("%"),'./'))<cr>
   nnoremap <buffer> <silent> b		:<c-u>call <SID>NetBookmarkDir(0,expand("%"))<cr>
@@ -1279,26 +1292,25 @@ fun! <SID>NetBrowse(dirname)
    " use ssh to get remote file listing
 "   call Decho("use ssh to get remote file listing")
    let shq= &shq? &shq : ( &sxq? &sxq : "'")
-"   call Decho("exe silent r! ".listcmd." ".shq.escape(path,s:netrw_cd_escape).shq)
+"   call Decho("exe silent r! ".listcmd." '".shq.escape(path,s:netrw_cd_escape).shq."'")
    exe "silent r! ".listcmd." ".shq.escape(path,s:netrw_cd_escape).shq
-if !exists("g:junk")
- let g:junk=1
-else
- put ='testing'
- return
-endif
    keepjumps 1d
    " cleanup
    if g:netrw_ftp_browse_reject != ""
     exe "silent! g/".g:netrw_ssh_browse_reject."/keepjumps d"
    endif
   endif
+  
 
   " set up syntax highlighting
   if has("syntax")
    setlocal ft=netrwlist
-   if !has("syntax_items")
+   if !exists("g:syntax_on") || !g:syntax_on
     setlocal ft=
+    " Ugly workaround -- when syntax highlighting is off and laststatus==2,
+    " sometimes the laststatus highlight bleeds into the entire display.
+    " Only seems to happen with remote browsing.  Weird.
+    redraw
    endif
   endif
 
@@ -1315,7 +1327,7 @@ endif
     if method == "ftp"
      " cleanup
      exe "keepjumps ".s:netrw_bannercnt
-     while getline(".") =~ '^total\s\+\d\+$' || getline(".") =~ 'Trying\s\+\d\+.*$'
+     while getline(".") =~ g:netrw_ftp_browse_reject
       keepjumps d
      endwhile
      " if there's no ../ listed, then put ./ and ../ in
@@ -1355,9 +1367,8 @@ endif
    endif
   endif
   exe "keepjumps ".s:netrw_bannercnt
-  setlocal nomod
-  setlocal noma
-  setlocal nonu
+
+  setlocal nomod noma nonu
 
 "  call Dret("NetBrowse")
   return
@@ -1497,7 +1508,7 @@ fun! <SID>NetBrowseRm(usrhost,path) rang
 "       call Decho("returned=".ret." errcode=".v:shell_error)
      
        if v:shell_error != 0 && !exists("g:netrw_quiet")
-        echoerr "***netrw*** unable to remove directory<".rmfile."> -- is it empty?"
+        echohl Error | echo "***netrw*** unable to remove directory<".rmfile."> -- is it empty?" | echohl None
         call inputsave()|call input("Press <cr> to continue")|call inputrestore()
        endif
       endif
@@ -1561,6 +1572,17 @@ fun! <SID>NetBrowseRename(usrhost,path) 
 endfun
 
 " ---------------------------------------------------------------------
+" NetRefresh: {{{2
+fun! <SID>NetRefresh(dirname)
+"  call Dfunc("NetRefresh(dirname<".a:dirname.">)")
+  set ma
+  %d
+  call <SID>NetBrowse(dirname)
+  redraw!
+"  call Dret("NetRefresh")
+endfun
+
+" ---------------------------------------------------------------------
 " NetBrowseX:  allows users to write custom functions to operate on {{{2
 "              files given their extension.  Passes 0=local, 1=remote
 fun! <SID>NetBrowseX(fname,remote)
@@ -1580,10 +1602,8 @@ fun! <SID>NetBrowseX(fname,remote)
    let fname= tempname().".".exten
 "   call Decho("create a local copy of <".a:fname."> as <".fname.">")
    exe "keepjumps silent bot 1new ".a:fname
-   let eikeep= &ei
-   set ei=all bh=delete
+   set bh=delete
    exe "w! ".fname
-   let &ei= eikeep
    q
   endif
 "  call Decho("exten<".exten."> "."NetrwFileHandler_".exten."():exists=".exists("*NetrwFileHandler_".exten))
@@ -1627,10 +1647,8 @@ fun! <SID>NetBrowseX(fname,remote)
   endif
 
   if a:remote == 1
-   let eikeep= &ei
-   set ei=all bh=delete bt=nofile noswf
+   set bh=delete bt=nofile noswf
    exe "norm! \<c-o>"
-   let &ei= eikeep
    redraw!
   endif
 
@@ -1764,7 +1782,7 @@ fun! <SID>NetHideEdit(mode)
   if a:mode == 0
    silent call s:NetBrowse(s:NetBrowseChgDir(expand("%"),'./'))
   else
-   silent call s:LocalBrowse(<SID>LocalBrowseChgDir(b:netrw_curdir,"./"))
+   silent call s:LocalRefresh(<SID>LocalBrowseChgDir(b:netrw_curdir,"./"))
   endif
 
 "  call Dret("NetHideEdit")
@@ -1809,6 +1827,8 @@ fun! <SID>NetLongList(mode)
    let g:netrw_list_cmd = g:netrw_list_cmd." -l"
   endif
   setlocal ma
+
+  " clear buffer - this will cause NetBrowse/LocalBrowse to do a refresh
   %d
 
   " refresh the listing
@@ -1818,7 +1838,7 @@ fun! <SID>NetLongList(mode)
    silent call <SID>LocalBrowse(<SID>LocalBrowseChgDir(b:netrw_curdir,"./"))
   endif
 
-  call s:NetRestorePosn()
+"  call s:NetRestorePosn()
 "  call Dret("NetLongList : g:netrw_longlist=".g:netrw_longlist)
 endfun
 
@@ -1866,7 +1886,7 @@ fun! <SID>NetMakeDir(usrhost)
 "   call Decho("fullnewdir<".fullnewdir.">")
    if isdirectory(fullnewdir)
     if !exists("g:netrw_quiet")
-     echoerr "***netrw*** <".newdirname."> is already a directory!"
+     echohl WarningMsg | echo "***netrw*** <".newdirname."> is already a directory!" | echohl None
      call inputsave()|call input("Press <cr> to continue")|call inputrestore()
     endif
 "    call Dret("NetMakeDir : directory<".newdirname."> exists previously")
@@ -1874,7 +1894,7 @@ fun! <SID>NetMakeDir(usrhost)
    endif
    if filereadable(fullnewdir)
     if !exists("g:netrw_quiet")
-     echoerr "***netrw*** <".newdirname."> is already a file!"
+     echohl WarningMsg | echo "***netrw*** <".newdirname."> is already a file!" | echohl None
      call inputsave()|call input("Press <cr> to continue")|call inputrestore()
     endif
 "    call Dret("NetMakeDir : file<".newdirname."> exists previously")
@@ -1900,11 +1920,12 @@ fun! <SID>NetMakeDir(usrhost)
     let linenum= line(".")
     norm! H0
     let hline  = line(".")
+    set ma|norm! 2D
     call s:LocalBrowse(s:LocalBrowseChgDir(b:netrw_curdir,'./'))
     exe "norm! ".hline."G0z\<CR>"
     exe linenum
    elseif !exists("g:netrw_quiet")
-    echoerr "***netrw*** unable to make directory<".newdirname.">"
+    echohl Error | echo "***netrw*** unable to make directory<".newdirname.">" | echohl None
     call inputsave()|call input("Press <cr> to continue")|call inputrestore()
    endif
    redraw!
@@ -1924,7 +1945,7 @@ fun! <SID>NetMakeDir(usrhost)
     exe "norm! ".hline."G0z\<CR>"
     exe linenum
    elseif !exists("g:netrw_quiet")
-    echoerr "***netrw*** unable to make directory<".newdirname.">"
+    echohl Error | echo "***netrw*** unable to make directory<".newdirname.">" | echohl None
     call inputsave()|call input("Press <cr> to continue")|call inputrestore()
    endif
    redraw!
@@ -1935,8 +1956,12 @@ endfun
 
 " ---------------------------------------------------------------------
 "  NetBookmarkDir: {{{2
-"    0: bookmark the current directory
-"    1: change to the bookmarked directory
+"    0: (user: <b>)   bookmark current directory
+"    1: (user: <B>)   change to the bookmarked directory
+"    2: (user: <q>)   list bookmarks
+"    3: (LocalBrowse) record current directory history
+"    4: (user: <u>)   go up   (previous) bookmark
+"    5: (user: <U>)   go down (next)     bookmark
 fun! <SID>NetBookmarkDir(chg,curdir)
 "  call Dfunc("NetBookmarkDir(chg=".a:chg." curdir<".a:curdir.">) cnt=".v:count)
 
@@ -1958,8 +1983,8 @@ fun! <SID>NetBookmarkDir(chg,curdir)
    endif
 
   elseif a:chg == 2
+   " list user's bookmarks
    if exists("g:NETRW_BOOKMARKMAX")
-    " list user's bookmarks
 "    call Decho("list bookmarks [0,".g:NETRW_BOOKMARKMAX."]")
     let cnt= 0
     while cnt <= g:NETRW_BOOKMARKMAX
@@ -1990,10 +2015,12 @@ fun! <SID>NetBookmarkDir(chg,curdir)
    endwhile
 
   elseif a:chg == 3
-   " saves most recently visited directories
-   let g:NETRW_DIRHIST_CNT= ( g:NETRW_DIRHIST_CNT + 1 ) % g:netrw_dirhistmax
-   let g:NETRW_DIRHIST_{g:NETRW_DIRHIST_CNT}= substitute(a:curdir,'[/\\]$','','e')
-"   call Decho("save dirhist#".g:NETRW_DIRHIST_CNT."<".g:NETRW_DIRHIST_{g:NETRW_DIRHIST_CNT}.">")
+   " saves most recently visited directories (when they differ)
+   if !exists("g:NETRW_DIRHIST_0") || g:NETRW_DIRHIST_{g:NETRW_DIRHIST_CNT} != a:curdir
+    let g:NETRW_DIRHIST_CNT= ( g:NETRW_DIRHIST_CNT + 1 ) % g:netrw_dirhistmax
+    let g:NETRW_DIRHIST_{g:NETRW_DIRHIST_CNT}= substitute(a:curdir,'[/\\]$','','e')
+"    call Decho("save dirhist#".g:NETRW_DIRHIST_CNT."<".g:NETRW_DIRHIST_{g:NETRW_DIRHIST_CNT}.">")
+   endif
 
   elseif a:chg == 4
    " u: change to the previous directory stored on the history list
@@ -2042,12 +2069,12 @@ fun! <SID>LocalBrowse(dirname)
 
   " unfortunate interaction -- when putting debugging calls
   " above one can no longer enter the DBG buffer.
-"  call Dfunc("LocalBrowse(dirname<".a:dirname.">) buf#".bufnr("%")." winnr=".winnr())
+"  call Dfunc("LocalBrowse(dirname<".a:dirname.">) buf#".bufnr("%")." winnr=".winnr()." sortby=".g:netrw_sort_by)
 "  call Dredir("ls!")
 
   if v:version < 603
    if !exists("g:netrw_quiet")
-    echoerr "***netrw*** vim version<".v:version."> too old for browsing with netrw"
+    echohl Error | echo "***netrw*** vim version<".v:version."> too old for browsing with netrw" | echohl None
     call inputsave()|call input("Press <cr> to continue")|call inputrestore()
    endif
 "   call Dret("LocalBrowse : vim version<".v:version."> too old")
@@ -2087,19 +2114,23 @@ fun! <SID>LocalBrowse(dirname)
    endif
 "   call Decho("enew buffer")
   else
-   let eikeep= &ei
-   set ei=BufEnter
    if v:version < 700
     exe "b ".bufnum
    else
     exe "keepalt b ".bufnum
    endif
-   let &ei= eikeep
-   if getline(2) =~ '^" Directory Listing '
-"    call Dret("LocalBrowse : reusing buffer#".bufnum."<".a:dirname.">")
-    return
+   if exists("s:last_sort_by") && g:netrw_sort_by == s:last_sort_by
+    if getline(2) =~ '^" Directory Listing '
+     if !g:netrw_keepdir
+"      call Decho("change directory: cd ".b:netrw_curdir)
+      exe 'cd '.b:netrw_curdir
+     endif
+"     call Dret("LocalBrowse : reusing buffer#".bufnum."<".a:dirname.">")
+     return
+    endif
    endif
   endif
+  let s:last_sort_by= g:netrw_sort_by
 
   " get the new directory name
   let b:netrw_curdir= substitute(a:dirname,'\\','/','ge')
@@ -2119,6 +2150,7 @@ fun! <SID>LocalBrowse(dirname)
 
   " make this buffer modifiable and hidden
   setlocal ma hidden nonu
+  keepalt silent! %d
 
   " ---------------------------
   "  Perform Directory Listing:
@@ -2129,9 +2161,9 @@ fun! <SID>LocalBrowse(dirname)
   " set up all the maps
 "  call Decho("Setting up local browser maps")
   nnoremap <buffer> <silent> <cr>	:exe "norm! 0"<bar>call <SID>LocalBrowse(<SID>LocalBrowseChgDir(b:netrw_curdir,<SID>NetGetWord()))<cr>
-  nnoremap <buffer> <silent> <c-l>	:exe "norm! 0"<bar>call <SID>LocalBrowse(<SID>LocalBrowseChgDir(b:netrw_curdir,'./'))<cr>
+  nnoremap <buffer> <silent> <c-l>	:set ma<bar>%d<bar>call <SID>LocalRefresh(<SID>LocalBrowseChgDir(b:netrw_curdir,'./'))<bar>redraw!<cr>
   nnoremap <buffer> <silent> -		:exe "norm! 0"<bar>call <SID>LocalBrowse(<SID>LocalBrowseChgDir(b:netrw_curdir,'../'))<cr>
-  nnoremap <buffer> <silent> a		:let g:netrw_hide=(g:netrw_hide+1)%3<bar>exe "norm! 0"<bar>call <SID>LocalBrowse(<SID>LocalBrowseChgDir(b:netrw_curdir,'./'))<cr>
+  nnoremap <buffer> <silent> a		:let g:netrw_hide=(g:netrw_hide+1)%3<bar>exe "norm! 0"<bar>call <SID>LocalRefresh(<SID>LocalBrowseChgDir(b:netrw_curdir,'./'))<cr>
   nnoremap <buffer> <silent> b		:<c-u>call <SID>NetBookmarkDir(0,b:netrw_curdir)<cr>
   nnoremap <buffer> <silent> B		:<c-u>call <SID>NetBookmarkDir(1,b:netrw_curdir)<cr>
   nnoremap <buffer> <silent> c		:exe "cd ".b:netrw_curdir<cr>
@@ -2148,7 +2180,9 @@ fun! <SID>LocalBrowse(dirname)
   nnoremap <buffer> <silent> U		:<c-u>call <SID>NetBookmarkDir(5,expand("%"))<cr>
   nnoremap <buffer> <silent> v		:exe (g:netrw_altv? "rightb " : "lefta ").g:netrw_winsize."wincmd v"<bar>exe "norm! 0"<bar>call <SID>LocalBrowse(<SID>LocalBrowseChgDir(b:netrw_curdir,<SID>NetGetWord()))<cr>
   nnoremap <buffer> <silent> x		:exe "norm! 0"<bar>call <SID>NetBrowseX(<SID>LocalBrowseChgDir(b:netrw_curdir,<SID>NetGetWord(),0),0)<cr>
-  nnoremap <buffer> <silent> <2-leftmouse> :exe "norm! 0"<bar>call <SID>LocalBrowse(<SID>LocalBrowseChgDir(b:netrw_curdir,<SID>NetGetWord()))<cr>
+  nnoremap <buffer> <silent> <2-leftmouse> :exe "norm! 0"<bar>call <SID>LocalRefresh(<SID>LocalBrowseChgDir(b:netrw_curdir,<SID>NetGetWord()))<cr>
+  nnoremap <buffer> <silent> <s-up>	:Pexplore<cr>
+  nnoremap <buffer> <silent> <s-down>	:Nexplore<cr>
   exe 'nnoremap <buffer> <silent> <del>	:exe "norm! 0"<bar>call <SID>LocalBrowseRm("'.b:netrw_curdir.'")<cr>'
   exe 'vnoremap <buffer> <silent> <del>	:call <SID>LocalBrowseRm("'.b:netrw_curdir.'")<cr>'
   exe 'nnoremap <buffer> <silent> D	:exe "norm! 0"<bar>call <SID>LocalBrowseRm("'.b:netrw_curdir.'")<cr>'
@@ -2208,7 +2242,7 @@ fun! <SID>LocalBrowse(dirname)
   " set up syntax highlighting
   if has("syntax")
    setlocal ft=netrwlist
-   if !has("syntax_items")
+   if !exists("g:syntax_on") || !g:syntax_on
     setlocal ft=
    endif
   endif
@@ -2305,11 +2339,11 @@ fun! LocalBrowseList()
    if isdirectory(filename)
     let pfile= filename."/"
    endif
-   let pfile= substitute(pfile,'^/','','e')
    if pfile =~ '//$'
     let pfile= substitute(pfile,'//$','/','e')
    endif
    let pfile= strpart(pfile,dirnamelen)
+   let pfile= substitute(pfile,'^/','','e')
 "   call Decho(" ")
 "   call Decho("filename<".filename.">")
 "   call Decho("pfile   <".pfile.">")
@@ -2401,7 +2435,7 @@ fun! <SID>LocalBrowseChgDir(dirname,newd
 endfun
 
 " ---------------------------------------------------------------------
-" LocalBrowseRm:
+" LocalBrowseRm: {{{2
 fun! <SID>LocalBrowseRm(path) range
 "  call Dfunc("LocalBrowseRm(path<".a:path.">)")
 "  call Decho("firstline=".a:firstline." lastline=".a:lastline)
@@ -2480,11 +2514,11 @@ fun! <SID>LocalBrowseRm(path) range
 "        call Decho("3rd attempt to remove directory<".rmfile.">")
 	call system("rm ".rmfile)
         if v:shell_error != 0 && !exists("g:netrw_quiet")
-         echoerr "***netrw*** unable to remove directory<".rmfile."> -- is it empty?"
+         echohl Error | echo "***netrw*** unable to remove directory<".rmfile."> -- is it empty?" | echohl None
          call inputsave()|call input("Press <cr> to continue")|call inputrestore()
 	endif
        elseif !exists("g:netrw_quiet")
-        echoerr "***netrw*** unable to remove directory<".rmfile."> -- is it empty?"
+        echohl Error | echo "***netrw*** unable to remove directory<".rmfile."> -- is it empty?" | echohl None
         call inputsave()|call input("Press <cr> to continue")|call inputrestore()
        endif
       endif
@@ -2501,7 +2535,7 @@ fun! <SID>LocalBrowseRm(path) range
   " refresh the directory
   let curline= line(".")
 "  call Decho("refresh the directory")
-  call <SID>LocalBrowse(<SID>LocalBrowseChgDir(b:netrw_curdir,'./'))
+  call s:LocalRefresh(s:LocalBrowseChgDir(b:netrw_curdir,'./'))
   exe curline
 
 "  call Dret("LocalBrowseRm")
@@ -2531,7 +2565,7 @@ fun! <SID>LocalBrowseRename(path) range
    endif
 
    norm! 0
-   let oldname= a:path.curword
+   let oldname= a:path."/".curword
 "   call Decho("oldname<".oldname.">")
 
    call inputsave()
@@ -2547,7 +2581,7 @@ fun! <SID>LocalBrowseRename(path) range
   " refresh the directory
   let curline= line(".")
 "  call Decho("refresh the directory listing")
-  call <SID>LocalBrowse(<SID>LocalBrowseChgDir(b:netrw_curdir,'./'))
+  call s:LocalRefresh(s:LocalBrowseChgDir(b:netrw_curdir,'./'))
   exe "keepjumps ".curline
 "  call Dret("LocalBrowseRename")
 endfun
@@ -2560,17 +2594,28 @@ fun! <SID>LocalPreview(path) range
    if !isdirectory(a:path)
     exe "pedit ".a:path
    elseif !exists("g:netrw_quiet")
-    echoerr "***netrw*** sorry, cannot preview a directory such as <".a:path.">"
+    echohl WarningMsg | echo "***netrw*** sorry, cannot preview a directory such as <".a:path.">" | echohl None
     call inputsave()|call input("Press <cr> to continue")|call inputrestore()
    endif
   elseif !exists("g:netrw_quiet")
-   echoerr "***netrw*** sorry, to preview your vim needs the quickfix feature compiled in"
+   echohl WarningMsg | echo "***netrw*** sorry, to preview your vim needs the quickfix feature compiled in" | echohl None
    call inputsave()|call input("Press <cr> to continue")|call inputrestore()
   endif
 "  call Dret("LocalPreview")
 endfun
 
 " ---------------------------------------------------------------------
+" LocalRefresh: {{{2
+fun! <SID>LocalRefresh(dirname)
+"  call Dfunc("LocalRefresh(dirname<".a:dirname.">)")
+  set ma
+  %d
+  call <SID>LocalBrowse(a:dirname)
+  redraw!
+"  call Dret("LocalRefresh")
+endfun
+
+" ---------------------------------------------------------------------
 " Explore: launch the local browser in the directory of the current file {{{2
 "          dosplit==0: the window will be split iff the current file has
 "                      been modified
@@ -2602,7 +2647,7 @@ fun! s:Explore(indx,dosplit,style,...)
 "   call Decho("calling LocalBrowse(newdir<".newdir.">)")
    call s:LocalBrowse(newdir)
 
-  elseif a:1 =~ '\*\*' || a:indx < 0
+  elseif a:1 =~ '\*\*/' || a:indx < 0
 
    if has("path_extra")
     if !exists("s:indx")
@@ -2617,13 +2662,20 @@ fun! s:Explore(indx,dosplit,style,...)
      let s:indx        = 0
      let s:explorelist = split(expand(b:netrw_curdir."/".a:1),'\n')
      let s:listlen     = len(s:explorelist)
+     if s:listlen == 1 && s:explorelist[0] =~ '\*\*\/'
+      echohl WarningMsg | echo "***netrw*** no files matched" | echohl None
+      call inputsave()|call input("Press <cr> to continue")|call inputrestore()
+"      call Dret("Explore")
+      return
+     endif
     endif
     let s:indx = indx
 "    call Decho("explorelist<".join(s:explorelist,',')."> len=".s:listlen)
 
     " sanity check
-    if indx >= s:listlen
-     echoerr "***netrw*** no more directories with matching files"
+    if indx >= s:listlen || indx < 0
+     let indx= (indx < 0)? 0 : ( s:listlen - 1 )
+     echohl WarningMsg | echo "***netrw*** no more files match Explore pattern" | echohl None
      call inputsave()|call input("Press <cr> to continue")|call inputrestore()
 "     call Dret("Explore")
      return
@@ -2639,9 +2691,9 @@ fun! s:Explore(indx,dosplit,style,...)
 
    else
     if v:version < 700
-     echoerr "***netrw*** you need vim version 7.0 or later for Exploring with **!"
+     echohl WarningMsg | echo "***netrw*** you need vim version 7.0 or later for Exploring with **!" | echohl None
     elseif !exists("g:netrw_quiet")
-     echoerr "***netrw*** your vim needs the path_extra feature for Exploring with **!"
+     echohl WarningMsg | echo "***netrw*** your vim needs the +path_extra feature for Exploring with **!" | echohl None | echohl None
     endif
     call inputsave()|call input("Press <cr> to continue")|call inputrestore()
    endif
@@ -2847,7 +2899,7 @@ fun! s:NetMethod(choice)  " globals: met
  
   else
    if !exists("g:netrw_quiet")
-    echoerr "***netrw*** cannot determine method"
+    echohl Error | echo "***netrw*** cannot determine method" | echohl None
     call inputsave()|call input("Press <cr> to continue")|call inputrestore()
    endif
    let b:netrw_method  = -1
--- a/runtime/syntax/sh.vim
+++ b/runtime/syntax/sh.vim
@@ -2,8 +2,8 @@
 " Language:		shell (sh) Korn shell (ksh) bash (sh)
 " Maintainer:		Dr. Charles E. Campbell, Jr.  <NdrOchipS@PcampbellAfamily.Mbiz>
 " Previous Maintainer:	Lennart Schultz <Lennart.Schultz@ecmwf.int>
-" Last Change:		Mar 24, 2005
-" Version:		74
+" Last Change:		Jul 01, 2005
+" Version:		75
 " URL:		http://www.erols.com/astronaut/vim/index.html#vimlinks_syntax
 "
 " Using the following VIM variables: {{{1
@@ -71,6 +71,7 @@ syn cluster shCaseEsacList	contains=shCa
 syn cluster shCaseList	contains=@shCommandSubList,shCaseEsac,shColon,shCommandSub,shCommandSub,shComment,shDo,shEcho,shExpr,shFor,shHereDoc,shIf,shRedir,shSetList,shSource,shStatement,shVariable,shSpecial
 syn cluster shColonList	contains=@shCaseList
 syn cluster shCommandSubList	contains=shArithmetic,shDeref,shDerefSimple,shNumber,shOperator,shPosnParm,shSpecial,shExSingleQuote,shSingleQuote,shDoubleQuote,shStatement,shVariable,shSubSh,shAlias,shTest
+syn cluster shCurlyList	contains=shNumber,shComma,shDeref,shDerefSimple,shDerefSpecial
 syn cluster shDblQuoteList	contains=shCommandSub,shDeref,shDerefSimple,shSpecial,shPosnParm
 syn cluster shDerefList	contains=shDeref,shDerefSimple,shDerefVar,shDerefSpecial,shDerefWordError
 syn cluster shDerefVarList	contains=shDerefOp,shDerefVarArray,shDerefOpError
@@ -154,7 +155,7 @@ syn match   shCharClass	contained	"\[:\(
 " ======
 syn region shDo		transparent matchgroup=shConditional start="\<do\>" matchgroup=shConditional end="\<done\>" contains=@shLoopList
 syn region shIf		transparent matchgroup=shConditional start="\<if\>" matchgroup=shConditional end="\<;\_s*then\>" end="\<fi\>"   contains=@shLoopList,shDblBrace,shDblParen
-syn region shFor	matchgroup=shLoop start="\<for\>" end="\<in\>" end="\<do\>"me=e-2	contains=@shLoopList,shDblParen
+syn region shFor	matchgroup=shLoop start="\<for\>" end="\<in\>" end="\<do\>"me=e-2	contains=@shLoopList,shDblParen skipwhite nextgroup=shCurlyIn
 if exists("b:is_kornshell") || exists("b:is_bash")
  syn cluster shCaseList add=shRepeat
  syn region shRepeat   matchgroup=shLoop   start="\<while\>" end="\<in\>" end="\<do\>"me=e-2	contains=@shLoopList,shDblParen,shDblBrace
@@ -164,6 +165,8 @@ else
  syn region shRepeat   matchgroup=shLoop   start="\<while\>" end="\<do\>"me=e-2		contains=@shLoopList
  syn region shRepeat   matchgroup=shLoop   start="\<until\>" end="\<do\>"me=e-2		contains=@shLoopList
 endif
+syn region shCurlyIn   contained	matchgroup=Delimiter start="{" end="}" contains=@shCurlyList
+syn match  shComma     contained	","
 
 " Case: case...esac {{{1
 " ====
--- a/runtime/syntax/vim.vim
+++ b/runtime/syntax/vim.vim
@@ -1,8 +1,8 @@
 " Vim syntax file
 " Language:	Vim 7.0 script
 " Maintainer:	Dr. Charles E. Campbell, Jr. <NdrOchipS@PcampbellAfamily.Mbiz>
-" Last Change:	March 21, 2005
-" Version:	7.0-10
+" Last Change:	August 02, 2005
+" Version:	7.0-11
 " Automatically generated keyword lists: {{{1
 
 " Quit when a syntax file was already loaded {{{2
@@ -16,11 +16,11 @@ syn keyword vimTodo contained	COMBAK	NOT
 syn cluster vimCommentGroup	contains=vimTodo,@Spell
 
 " regular vim commands {{{2
-syn keyword vimCommand contained	ab[breviate] abc[lear] abo[veleft] al[l] arga[dd] argd[elete] argdo arge[dit] argg[lobal] argl[ocal] ar[gs] argu[ment] as[cii] bad[d] ba[ll] bd[elete] be bel[owright] bf[irst] bl[ast] bm[odified] bn[ext] bN[ext] bo[tright] bp[revious] brea[k] breaka[dd] breakd[el] breakl[ist] br[ewind] bro[wse] bufdo b[uffer] buffers bun[load] bw[ipeout] ca[bbrev] cabc[lear] cal[l] cat[ch] cb[uffer] cc ccl[ose] cd ce[nter] cf[ile] cfir[st] cg[etfile] c[hange] changes chd[ir] che[ckpath] checkt[ime] cla[st] cl[ist] clo[se] cmapc[lear] cnew[er] cn[ext] cN[ext] cnf[ile] cNf[ile] cnorea[bbrev] col[der] colo[rscheme] comc[lear] comp[iler] conf[irm] con[tinue] cope[n] co[py] cpf[ile] cp[revious] cq[uit] cr[ewind] cuna[bbrev] cu[nmap] cw[indow] debugg[reedy] delc[ommand] d[elete] DeleteFirst delf[unction] delm[arks] diffg[et] diffoff diffpatch diffpu[t] diffsplit diffthis dig[raphs] di[splay] dj[ump] dl[ist] dr[op] ds[earch] dsp[lit] echoe[rr] echom[sg] echon e[dit] el[se] elsei[f] em[enu] emenu* endfo[r] endf[unction] en[dif] endt[ry] endw[hile] ene[w] ex exi[t] exu[sage] f[ile] files filetype fina[lly] fin[d] fini[sh] fir[st] fix[del] fo[ld] foldc[lose] folddoc[losed] foldd[oopen] foldo[pen] for fu[nction] g[lobal] go[to] gr[ep] grepa[dd] ha[rdcopy] h[elp] helpf[ind] helpg[rep] helpt[ags] hid[e] his[tory] I ia[bbrev] iabc[lear] if ij[ump] il[ist] imapc[lear] inorea[bbrev] is[earch] isp[lit] iuna[bbrev] iu[nmap] j[oin] ju[mps] k keepalt keepj[umps] kee[pmarks] lan[guage] la[st] lc[d] lch[dir] le[ft] lefta[bove] l[ist] lm[ap] lmapc[lear] ln[oremap] lo[adview] loc[kmarks] lockv[ar] ls lu[nmap] mak[e] ma[rk] marks mat[ch] menut[ranslate] mk[exrc] mks[ession] mkvie[w] mkv[imrc] mod[e] m[ove] mzf[ile] mz[scheme] nbkey new n[ext] N[ext] nmapc[lear] noh[lsearch] norea[bbrev] Nread nu[mber] nun[map] Nw omapc[lear] on[ly] o[pen] opt[ions] ou[nmap] pc[lose] ped[it] pe[rl] perld[o] po[p] popu popu[p] pp[op] pre[serve] prev[ious] p[rint] P[rint] prof[ile] prompt promptf[ind] promptr[epl] ps[earch] pta[g] ptf[irst] ptj[ump] ptl[ast] ptn[ext] ptN[ext] ptp[revious] ptr[ewind] pts[elect] pu[t] pw[d] pyf[ile] py[thon] qa[ll] q[uit] quita[ll] r[ead] rec[over] redi[r] red[o] redr[aw] redraws[tatus] reg[isters] res[ize] ret[ab] retu[rn] rew[ind] ri[ght] rightb[elow] rub[y] rubyd[o] rubyf[ile] ru[ntime] rv[iminfo] sal[l] sandbox sa[rgument] sav[eas] sba[ll] sbf[irst] sbl[ast] sbm[odified] sbn[ext] sbN[ext] sbp[revious] sbr[ewind] sb[uffer] scripte[ncoding] scrip[tnames] se[t] setf[iletype] setg[lobal] setl[ocal] sf[ind] sfir[st] sh[ell] sign sil[ent] sim[alt] sla[st] sl[eep] sm[agic] sn[ext] sN[ext] sni[ff] sno[magic] so[urce] sp[lit] spr[evious] sre[wind] sta[g] star[tinsert] startr[eplace] stj[ump] st[op] stopi[nsert] sts[elect] sun[hide] sus[pend] sv[iew] syncbind t ta[g] tags tc[l] tcld[o] tclf[ile] te[aroff] tf[irst] the th[row] tj[ump] tl[ast] tm tm[enu] tn[ext] tN[ext] to[pleft] tp[revious] tr[ewind] try ts[elect] tu tu[nmenu] una[bbreviate] u[ndo] unh[ide] unlo[ckvar] unm[ap] up[date] verb[ose] ve[rsion] vert[ical] v[global] vie[w] vim[grep] vimgrepa[dd] vi[sual] viu[sage] vmapc[lear] vne[w] vs[plit] vu[nmap] wa[ll] wh[ile] winc[md] windo winp[os] win[size] wn[ext] wN[ext] wp[revious] wq wqa[ll] w[rite] ws[verb] wv[iminfo] X xa[ll] x[it] y[ank] 
+syn keyword vimCommand contained	ab[breviate] abc[lear] abo[veleft] al[l] arga[dd] argd[elete] argdo arge[dit] argg[lobal] argl[ocal] ar[gs] argu[ment] as[cii] bad[d] ba[ll] bd[elete] be bel[owright] bf[irst] bl[ast] bm[odified] bn[ext] bN[ext] bo[tright] bp[revious] brea[k] breaka[dd] breakd[el] breakl[ist] br[ewind] bro[wse] bufdo b[uffer] buffers bun[load] bw[ipeout] ca[bbrev] cabc[lear] cad[dfile] cal[l] cat[ch] cb[uffer] cc ccl[ose] cd ce[nter] cex[pr] cf[ile] cfir[st] cg[etfile] c[hange] changes chd[ir] che[ckpath] checkt[ime] cla[st] cl[ist] clo[se] cmapc[lear] cnew[er] cn[ext] cN[ext] cnf[ile] cNf[ile] cnorea[bbrev] col[der] colo[rscheme] comc[lear] comp[iler] conf[irm] con[tinue] cope[n] co[py] cpf[ile] cp[revious] cq[uit] cr[ewind] cuna[bbrev] cu[nmap] cw[indow] debugg[reedy] delc[ommand] d[elete] DeleteFirst delf[unction] delm[arks] diffg[et] diffoff diffpatch diffpu[t] diffsplit diffthis diffu[pdate] dig[raphs] di[splay] dj[ump] dl[ist] dr[op] ds[earch] dsp[lit] echoe[rr] echom[sg] echon e[dit] el[se] elsei[f] em[enu] emenu* endfo[r] endf[unction] en[dif] endt[ry] endw[hile] ene[w] ex exi[t] exu[sage] f[ile] files filetype fina[lly] fin[d] fini[sh] fir[st] fix[del] fo[ld] foldc[lose] folddoc[losed] foldd[oopen] foldo[pen] for fu[nction] g[lobal] go[to] gr[ep] grepa[dd] ha[rdcopy] h[elp] helpf[ind] helpg[rep] helpt[ags] hid[e] his[tory] I ia[bbrev] iabc[lear] if ij[ump] il[ist] imapc[lear] inorea[bbrev] is[earch] isp[lit] iuna[bbrev] iu[nmap] j[oin] ju[mps] k keepalt keepj[umps] kee[pmarks] lan[guage] la[st] lc[d] lch[dir] le[ft] lefta[bove] l[ist] lm[ap] lmapc[lear] ln[oremap] lo[adview] loc[kmarks] lockv[ar] ls lu[nmap] mak[e] ma[rk] marks mat[ch] menut[ranslate] mk[exrc] mks[ession] mksp[ell] mkvie[w] mkv[imrc] mod[e] m[ove] mzf[ile] mz[scheme] nbkey new n[ext] N[ext] nmapc[lear] noh[lsearch] norea[bbrev] Nread nu[mber] nun[map] Nw omapc[lear] on[ly] o[pen] opt[ions] ou[nmap] pc[lose] ped[it] pe[rl] perld[o] po[p] popu popu[p] pp[op] pre[serve] prev[ious] p[rint] P[rint] profd[el] prof[ile] prompt promptf[ind] promptr[epl] ps[earch] pta[g] ptf[irst] ptj[ump] ptl[ast] ptn[ext] ptN[ext] ptp[revious] ptr[ewind] pts[elect] pu[t] pw[d] pyf[ile] py[thon] qa[ll] q[uit] quita[ll] r[ead] rec[over] redi[r] red[o] redr[aw] redraws[tatus] reg[isters] res[ize] ret[ab] retu[rn] rew[ind] ri[ght] rightb[elow] rub[y] rubyd[o] rubyf[ile] ru[ntime] rv[iminfo] sal[l] san[dbox] sa[rgument] sav[eas] sba[ll] sbf[irst] sbl[ast] sbm[odified] sbn[ext] sbN[ext] sbp[revious] sbr[ewind] sb[uffer] scripte[ncoding] scrip[tnames] se[t] setf[iletype] setg[lobal] setl[ocal] sf[ind] sfir[st] sh[ell] sign sil[ent] sim[alt] sla[st] sl[eep] sm[agic] sn[ext] sN[ext] sni[ff] sno[magic] sor[t] so[urce] spelld[ump] spe[llgood] spellr[epall] spellw[rong] sp[lit] spr[evious] sre[wind] sta[g] star[tinsert] startr[eplace] stj[ump] st[op] stopi[nsert] sts[elect] sun[hide] sus[pend] sv[iew] syncbind t ta[g] tags tc[l] tcld[o] tclf[ile] te[aroff] tf[irst] the th[row] tj[ump] tl[ast] tm tm[enu] tn[ext] tN[ext] to[pleft] tp[revious] tr[ewind] try ts[elect] tu tu[nmenu] una[bbreviate] u[ndo] unh[ide] unlo[ckvar] unm[ap] up[date] verb[ose] ve[rsion] vert[ical] v[global] vie[w] vim[grep] vimgrepa[dd] vi[sual] viu[sage] vmapc[lear] vne[w] vs[plit] vu[nmap] wa[ll] wh[ile] winc[md] windo winp[os] win[size] wn[ext] wN[ext] wp[revious] wq wqa[ll] w[rite] ws[verb] wv[iminfo] X xa[ll] x[it] y[ank] 
 syn match   vimCommand contained	"\<z[-+^.=]"
 
 " vimOptions are caught only when contained in a vimSet {{{2
-syn keyword vimOption contained	: acd ai akm al aleph allowrevins altkeymap ambiwidth ambw anti antialias ar arab arabic arabicshape ari arshape autochdir autoindent autoread autowrite autowriteall aw awa background backspace backup backupcopy backupdir backupext backupskip balloondelay ballooneval balloonexpr bdir bdlay beval bex bexpr bg bh bin binary biosk bioskey bk bkc bl bomb breakat brk browsedir bs bsdir bsk bt bufhidden buflisted buftype casemap cb ccv cd cdpath cedit cf cfu ch charconvert ci cin cindent cink cinkeys cino cinoptions cinw cinwords clipboard cmdheight cmdwinheight cmp cms co columns com comments commentstring compatible complete completefunc confirm consk conskey copyindent cp cpo cpoptions cpt cscopepathcomp cscopeprg cscopequickfix cscopetag cscopetagorder cscopeverbose cspc csprg csqf cst csto csverb cwh debug deco def define delcombine dex dg dict dictionary diff diffexpr diffopt digraph dip dir directory display dy ea ead eadirection eb ed edcompatible ef efm ei ek enc encoding endofline eol ep equalalways equalprg errorbells errorfile errorformat esckeys et eventignore ex expandtab exrc fcl fcs fdc fde fdi fdl fdls fdm fdn fdo fdt fen fenc fencs ff ffs fileencoding fileencodings fileformat fileformats filetype fillchars fk fkmap flp fml fmr fo foldclose foldcolumn foldenable foldexpr foldignore foldlevel foldlevelstart foldmarker foldmethod foldminlines foldnestmax foldopen foldtext formatlistpat formatoptions formatprg fp fs fsync ft gcr gd gdefault gfm gfn gfs gfw ghr go gp grepformat grepprg guicursor guifont guifontset guifontwide guiheadroom guioptions guipty helpfile helpheight helplang hf hh hi hid hidden highlight history hk hkmap hkmapp hkp hl hlg hls hlsearch ic icon iconstring ignorecase im imactivatekey imak imc imcmdline imd imdisable imi iminsert ims imsearch inc include includeexpr incsearch inde indentexpr indentkeys indk inex inf infercase insertmode is isf isfname isi isident isk iskeyword isp isprint joinspaces js key keymap keymodel keywordprg km kmp kp langmap langmenu laststatus lazyredraw lbr lcs linebreak lines linespace lisp lispwords list listchars lm lmap loadplugins lpl ls lsp lw lz ma magic makeef makeprg mat matchpairs matchtime maxfuncdepth maxmapdepth maxmem maxmempattern maxmemtot mef menuitems mfd mh mis ml mls mm mmd mmp mmt mod modeline modelines modifiable modified more mouse mousef mousefocus mousehide mousem mousemodel mouses mouseshape mouset mousetime mp mps mzq mzquantum nf nrformats nu number numberwidth nuw oft osfiletype pa para paragraphs paste pastetoggle patchexpr patchmode path pdev penc pex pexpr pfn pheader pi pm pmbcs pmbfn popt preserveindent previewheight previewwindow printdevice printencoding printexpr printfont printheader printmbcharset printmbfont printoptions prompt pt pvh pvw qe quoteescape readonly remap report restorescreen revins ri rightleft rightleftcmd rl rlc ro rs rtp ru ruf ruler rulerformat runtimepath sb sbo sbr sc scb scr scroll scrollbind scrolljump scrolloff scrollopt scs sect sections secure sel selection selectmode sessionoptions sft sh shcf shell shellcmdflag shellpipe shellquote shellredir shellslash shelltemp shelltype shellxquote shiftround shiftwidth shm shortmess shortname showbreak showcmd showfulltag showmatch showmode shq si sidescroll sidescrolloff siso sj slm sm smartcase smartindent smarttab smd sn so softtabstop sol sp spell spelllang spl splitbelow splitright spr sr srr ss ssl ssop st sta startofline statusline stl stmp sts su sua suffixes suffixesadd sw swapfile swapsync swb swf switchbuf sws sxq syn syntax ta tabstop tag tagbsearch taglength tagrelative tags tagstack tb tbi tbidi tbis tbs tenc term termbidi termencoding terse textauto textmode textwidth tf tgst thesaurus tildeop timeout timeoutlen title titlelen titleold titlestring tl tm to toolbar toolbariconsize top tr ts tsl tsr ttimeout ttimeoutlen ttm tty ttybuiltin ttyfast ttym ttymouse ttyscroll ttytype tw tx uc ul undolevels updatecount updatetime ut vb vbs vdir ve verbose vi viewdir viewoptions viminfo virtualedit visualbell vop wa wak warn wb wc wcm wd weirdinvert wfh wh whichwrap wi wig wildchar wildcharm wildignore wildmenu wildmode wildoptions wim winaltkeys window winfixheight winheight winminheight winminwidth winwidth wiv wiw wm wmh wmnu wmw wop wrap wrapmargin wrapscan write writeany writebackup writedelay ws ww 
+syn keyword vimOption contained	: acd ai akm al aleph allowrevins altkeymap ambiwidth ambw anti antialias ar arab arabic arabicshape ari arshape autochdir autoindent autoread autowrite autowriteall aw awa background backspace backup backupcopy backupdir backupext backupskip balloondelay ballooneval balloonexpr bdir bdlay beval bex bexpr bg bh bin binary biosk bioskey bk bkc bl bomb breakat brk browsedir bs bsdir bsk bt bufhidden buflisted buftype casemap cb ccv cd cdpath cedit cf cfu ch charconvert ci cin cindent cink cinkeys cino cinoptions cinw cinwords clipboard cmdheight cmdwinheight cmp cms co columns com comments commentstring compatible complete completefunc confirm consk conskey copyindent cp cpo cpoptions cpt cscopepathcomp cscopeprg cscopequickfix cscopetag cscopetagorder cscopeverbose cspc csprg csqf cst csto csverb cwh debug deco def define delcombine dex dg dict dictionary diff diffexpr diffopt digraph dip dir directory display dy ea ead eadirection eb ed edcompatible ef efm ei ek enc encoding endofline eol ep equalalways equalprg errorbells errorfile errorformat esckeys et eventignore ex expandtab exrc fcl fcs fdc fde fdi fdl fdls fdm fdn fdo fdt fen fenc fencs ff ffs fileencoding fileencodings fileformat fileformats filetype fillchars fk fkmap flp fml fmr fo foldclose foldcolumn foldenable foldexpr foldignore foldlevel foldlevelstart foldmarker foldmethod foldminlines foldnestmax foldopen foldtext formatlistpat formatoptions formatprg fp fs fsync ft gcr gd gdefault gfm gfn gfs gfw ghr go gp grepformat grepprg guicursor guifont guifontset guifontwide guiheadroom guioptions guipty helpfile helpheight helplang hf hh hi hid hidden highlight history hk hkmap hkmapp hkp hl hlg hls hlsearch ic icon iconstring ignorecase im imactivatekey imak imc imcmdline imd imdisable imi iminsert ims imsearch inc include includeexpr incsearch inde indentexpr indentkeys indk inex inf infercase insertmode is isf isfname isi isident isk iskeyword isp isprint joinspaces js key keymap keymodel keywordprg km kmp kp langmap langmenu laststatus lazyredraw lbr lcs linebreak lines linespace lisp lispwords list listchars lm lmap loadplugins lpl ls lsp lw lz ma magic makeef makeprg mat matchpairs matchtime maxfuncdepth maxmapdepth maxmem maxmempattern maxmemtot mef menuitems mfd mh mis ml mls mm mmd mmp mmt mod modeline modelines modifiable modified more mouse mousef mousefocus mousehide mousem mousemodel mouses mouseshape mouset mousetime mp mps mzq mzquantum nf nrformats nu number numberwidth nuw oft osfiletype pa para paragraphs paste pastetoggle patchexpr patchmode path pdev penc pex pexpr pfn pheader pi pm pmbcs pmbfn popt preserveindent previewheight previewwindow printdevice printencoding printexpr printfont printheader printmbcharset printmbfont printoptions prompt pt pvh pvw qe quoteescape readonly remap report restorescreen revins ri rightleft rightleftcmd rl rlc ro rs rtp ru ruf ruler rulerformat runtimepath sb sbo sbr sc scb scr scroll scrollbind scrolljump scrolloff scrollopt scs sect sections secure sel selection selectmode sessionoptions sft sh shcf shell shellcmdflag shellpipe shellquote shellredir shellslash shelltemp shelltype shellxquote shiftround shiftwidth shm shortmess shortname showbreak showcmd showfulltag showmatch showmode shq si sidescroll sidescrolloff siso sj slm sm smartcase smartindent smarttab smc smd sn so softtabstop sol sp spc spell spellcapcheck spellfile spelllang spellsuggest spf spl splitbelow splitright spr sps sr srr ss ssl ssop st sta startofline statusline stl stmp sts su sua suffixes suffixesadd sw swapfile swapsync swb swf switchbuf sws sxq syn synmaxcol syntax ta tabstop tag tagbsearch taglength tagrelative tags tagstack tb tbi tbidi tbis tbs tenc term termbidi termencoding terse textauto textmode textwidth tf tgst thesaurus tildeop timeout timeoutlen title titlelen titleold titlestring tl tm to toolbar toolbariconsize top tr ts tsl tsr ttimeout ttimeoutlen ttm tty ttybuiltin ttyfast ttym ttymouse ttyscroll ttytype tw tx uc ul undolevels updatecount updatetime ut vb vbs vdir ve verbose verbosefile vfile vi viewdir viewoptions viminfo virtualedit visualbell vop wa wak warn wb wc wcm wd weirdinvert wfh wh whichwrap wi wig wildchar wildcharm wildignore wildmenu wildmode wildoptions wim winaltkeys window winfixheight winheight winminheight winminwidth winwidth wiv wiw wm wmh wmnu wmw wop wrap wrapmargin wrapscan write writeany writebackup writedelay ws ww 
 
 " vimOptions: These are the turn-off setting variants {{{2
 syn keyword vimOption contained	noacd noai noakm noallowrevins noaltkeymap noanti noantialias noar noarab noarabic noarabicshape noari noarshape noautochdir noautoindent noautoread noautowrite noautowriteall noaw noawa nobackup noballooneval nobeval nobin nobinary nobiosk nobioskey nobk nobl nobomb nobuflisted nocf noci nocin nocindent nocompatible noconfirm noconsk noconskey nocopyindent nocp nocscopetag nocscopeverbose nocst nocsverb nodeco nodelcombine nodg nodiff nodigraph nodisable noea noeb noed noedcompatible noek noendofline noeol noequalalways noerrorbells noesckeys noet noex noexpandtab noexrc nofen nofk nofkmap nofoldenable nogd nogdefault noguipty nohid nohidden nohk nohkmap nohkmapp nohkp nohls nohlsearch noic noicon noignorecase noim noimc noimcmdline noimd noincsearch noinf noinfercase noinsertmode nois nojoinspaces nojs nolazyredraw nolbr nolinebreak nolisp nolist noloadplugins nolpl nolz noma nomagic nomh noml nomod nomodeline nomodifiable nomodified nomore nomousef nomousefocus nomousehide nonu nonumber nopaste nopi nopreserveindent nopreviewwindow noprompt nopvw noreadonly noremap norestorescreen norevins nori norightleft norightleftcmd norl norlc noro nors noru noruler nosb nosc noscb noscrollbind noscs nosecure nosft noshellslash noshelltemp noshiftround noshortname noshowcmd noshowfulltag noshowmatch noshowmode nosi nosm nosmartcase nosmartindent nosmarttab nosmd nosn nosol nospell nosplitbelow nosplitright nospr nosr nossl nosta nostartofline nostmp noswapfile noswf nota notagbsearch notagrelative notagstack notbi notbidi notbs notermbidi noterse notextauto notextmode notf notgst notildeop notimeout notitle noto notop notr nottimeout nottybuiltin nottyfast notx novb novisualbell nowa nowarn nowb noweirdinvert nowfh nowildmenu nowinfixheight nowiv nowmnu nowrap nowrapscan nowrite nowriteany nowritebackup nows 
@@ -44,18 +44,18 @@ syn keyword vimErrSetting contained	hard
 
 " AutoBuf Events {{{2
 syn case ignore
-syn keyword vimAutoEvent contained	BufAdd BufCreate BufDelete BufEnter BufFilePost BufFilePre BufHidden BufLeave BufNew BufNewFile BufRead BufReadCmd BufReadPost BufReadPre BufUnload BufWinEnter BufWinLeave BufWipeout BufWrite BufWriteCmd BufWritePost BufWritePre Cmd-event CmdwinEnter CmdwinLeave ColorScheme CursorHold E135 E143 E200 E201 E203 E204 EncodingChanged FileAppendCmd FileAppendPost FileAppendPre FileChangedRO FileChangedShell FileEncoding FileReadCmd FileReadPost FileReadPre FileType FileWriteCmd FileWritePost FileWritePre FilterReadPost FilterReadPre FilterWritePost FilterWritePre FocusGained FocusLost FuncUndefined GUIEnter InsertChange InsertEnter InsertLeave QuickFixCmdPost QuickFixCmdPre RemoteReply StdinReadPost StdinReadPre Syntax TermChanged TermResponse User UserGettingBored VimEnter VimLeave VimLeavePre WinEnter WinLeave 
+syn keyword vimAutoEvent contained	BufAdd BufCreate BufDelete BufEnter BufFilePost BufFilePre BufHidden BufLeave BufNew BufNewFile BufRead BufReadCmd BufReadPost BufReadPre BufUnload BufWinEnter BufWinLeave BufWipeout BufWrite BufWriteCmd BufWritePost BufWritePre Cmd-event CmdwinEnter CmdwinLeave ColorScheme CursorHold E135 E143 E200 E201 E203 E204 EncodingChanged FileAppendCmd FileAppendPost FileAppendPre FileChangedRO FileChangedShell FileEncoding FileReadCmd FileReadPost FileReadPre FileType FileWriteCmd FileWritePost FileWritePre FilterReadPost FilterReadPre FilterWritePost FilterWritePre FocusGained FocusLost FuncUndefined GUIEnter InsertChange InsertEnter InsertLeave MenuPopup QuickFixCmdPost QuickFixCmdPre RemoteReply StdinReadPost StdinReadPre Syntax TermChanged TermResponse User UserGettingBored VimEnter VimLeave VimLeavePre WinEnter WinLeave 
 
 " Highlight commonly used Groupnames {{{2
 syn keyword vimGroup contained	Comment Constant String Character Number Boolean Float Identifier Function Statement Conditional Repeat Label Operator Keyword Exception PreProc Include Define Macro PreCondit Type StorageClass Structure Typedef Special SpecialChar Tag Delimiter SpecialComment Debug Underlined Ignore Error Todo 
 
 " Default highlighting groups {{{2
-syn keyword vimHLGroup contained	Cursor CursorIM DiffAdd DiffChange DiffDelete DiffText Directory ErrorMsg FoldColumn Folded IncSearch LineNr Menu ModeMsg MoreMsg NonText Normal Question Scrollbar Search SignColumn SpecialKey SpellBad SpellLocal SpellRare StatusLine StatusLineNC Title Tooltip VertSplit Visual VisualNOS WarningMsg WildMenu 
+syn keyword vimHLGroup contained	Cursor CursorIM DiffAdd DiffChange DiffDelete DiffText Directory ErrorMsg FoldColumn Folded IncSearch LineNr Menu ModeMsg MoreMsg NonText Normal Question Scrollbar Search SignColumn SpecialKey SpellBad SpellCap SpellLocal SpellRare StatusLine StatusLineNC Title Tooltip VertSplit Visual VisualNOS WarningMsg WildMenu 
 syn match vimHLGroup contained	"Conceal"
 syn case match
 
 " Function Names {{{2
-syn keyword vimFuncName contained	add append argc argidx argv browse browsedir bufexists buflisted bufloaded bufname bufnr bufwinnr byte2line byteidx call char2nr cindent col confirm copy count cscope_connection cursor deepcopy delete did_filetype diff_filler diff_hlID empty errorlist escape eval eventhandler executable exists expand expr8 extend filereadable filewritable filter finddir findfile fnamemodify foldclosed foldclosedend foldlevel foldtext foldtextresult foreground function get getbufvar getchar getcharmod getcmdline getcmdpos getcwd getfontname getfperm getfsize getftime getftype getline getreg getregtype getwinposx getwinposy getwinvar glob globpath has has_key hasmapto histadd histdel histget histnr hlexists hlID hostname iconv indent index input inputdialog inputrestore inputsave inputsecret insert isdirectory islocked items join keys len libcall libcallnr line line2byte lispindent localtime map maparg mapcheck match matchend matchlist matchstr max min mkdir mode nextnonblank nr2char prevnonblank range readfile remote_expr remote_foreground remote_peek remote_read remote_send remove rename repeat resolve reverse search searchpair server2client serverlist setbufvar setcmdpos setline setreg setwinvar simplify sort split strftime stridx string strlen strpart strridx strtrans submatch substitute synID synIDattr synIDtrans system taglist tempname tolower toupper tr type values virtcol visualmode winbufnr wincol winheight winline winnr winrestcmd winwidth writefile soundfold spellsuggest spellbadword
+syn keyword vimFuncName contained	add append argc argidx argv browse browsedir bufexists buflisted bufloaded bufname bufnr bufwinnr byte2line byteidx call char2nr cindent col confirm copy count cscope_connection cursor deepcopy delete did_filetype diff_filler diff_hlID empty escape eval eventhandler executable exists expand expr8 extend filereadable filewritable filter finddir findfile fnamemodify foldclosed foldclosedend foldlevel foldtext foldtextresult foreground function garbagecollect get getbufline getbufvar getchar getcharmod getcmdline getcmdpos getcwd getfontname getfperm getfsize getftime getftype getline getqflist getreg getregtype getwinposx getwinposy getwinvar glob globpath has has_key hasmapto histadd histdel histget histnr hlexists hlID hostname iconv indent index input inputdialog inputrestore inputsave inputsecret insert isdirectory islocked items join keys len libcall libcallnr line line2byte lispindent localtime map maparg mapcheck match matchend matchlist matchstr max min mkdir mode nextnonblank nr2char prevnonblank printf range readfile remote_expr remote_foreground remote_peek remote_read remote_send remove rename repeat resolve reverse search searchpair server2client serverlist setbufvar setcmdpos setline setqflist setreg setwinvar simplify sort soundfold spellbadword spellsuggest split strftime stridx string strlen strpart strridx strtrans submatch substitute synID synIDattr synIDtrans system taglist tempname tolower toupper tr type values virtcol visualmode winbufnr wincol winheight winline winnr winrestcmd winwidth writefile 
 
 "--- syntax above generated by mkvimvim ---
 " Special Vim Highlighting (not automatic) {{{1
--- a/src/edit.c
+++ b/src/edit.c
@@ -34,8 +34,6 @@
 #define CTRL_X_OCCULT		13
 #define CTRL_X_LOCAL_MSG	14	/* only used in "ctrl_x_msgs" */
 
-#define CHECK_KEYS_TIME		30
-
 #define CTRL_X_MSG(i) ctrl_x_msgs[(i) & ~CTRL_X_WANT_IDENT]
 
 static char *ctrl_x_msgs[] =
@@ -62,18 +60,18 @@ static char_u e_hitend[] = N_("Hit end o
 /*
  * Structure used to store one match for insert completion.
  */
+typedef struct Completion compl_T;
 struct Completion
 {
-    struct Completion	*next;
-    struct Completion	*prev;
-    char_u		*str;	  /* matched text */
-    char_u		*fname;	  /* file containing the match */
-    int			original; /* ORIGINAL_TEXT, CONT_S_IPOS or FREE_FNAME */
-    int			number;	  /* sequence number */
+    compl_T	*cp_next;
+    compl_T	*cp_prev;
+    char_u	*cp_str;	/* matched text */
+    char_u	*cp_fname;	/* file containing the match */
+    int		cp_flags;	/* ORIGINAL_TEXT, CONT_S_IPOS or FREE_FNAME */
+    int		cp_number;	/* sequence number */
 };
 
-/* the original text when the expansion begun */
-#define ORIGINAL_TEXT	(1)
+#define ORIGINAL_TEXT	(1)   /* the original text when the expansion begun */
 #define FREE_FNAME	(2)
 
 /*
@@ -83,31 +81,30 @@ struct Completion
  * "compl_shown_match" is different from compl_curr_match during
  * ins_compl_get_exp().
  */
-static struct Completion    *compl_first_match = NULL;
-static struct Completion    *compl_curr_match = NULL;
-static struct Completion    *compl_shown_match = NULL;
+static compl_T    *compl_first_match = NULL;
+static compl_T    *compl_curr_match = NULL;
+static compl_T    *compl_shown_match = NULL;
 
 /* When the first completion is done "compl_started" is set.  When it's
  * FALSE the word to be completed must be located. */
 static int		    compl_started = FALSE;
 
-static int		    compl_matches = 0;
-static char_u		    *compl_pattern = NULL;
-static int		    compl_direction = FORWARD;
-static int		    compl_shows_dir = FORWARD;
-static int		    compl_pending = FALSE;
-static pos_T		    compl_startpos;
-static colnr_T		    compl_col = 0;	/* column where the text starts
-						   that is being completed */
-static int		    save_sm = -1;
-static char_u		    *compl_orig_text = NULL;  /* text as it was before
-							 completion started */
-static int		    compl_cont_mode = 0;
-static expand_T		    compl_xp;
+static int	  compl_matches = 0;
+static char_u	  *compl_pattern = NULL;
+static int	  compl_direction = FORWARD;
+static int	  compl_shows_dir = FORWARD;
+static int	  compl_pending = FALSE;
+static pos_T	  compl_startpos;
+static colnr_T	  compl_col = 0;	    /* column where the text starts
+					     * that is being completed */
+static int	  save_sm = -1;
+static char_u	  *compl_orig_text = NULL;  /* text as it was before
+					     * completion started */
+static int	  compl_cont_mode = 0;
+static expand_T	  compl_xp;
 
 static void ins_ctrl_x __ARGS((void));
 static int  has_compl_option __ARGS((int dict_opt));
-static int  ins_compl_add __ARGS((char_u *str, int len, char_u *, int dir, int reuse));
 static void ins_compl_add_matches __ARGS((int num_matches, char_u **matches, int dir));
 static int  ins_compl_make_cyclic __ARGS((void));
 static void ins_compl_dictionaries __ARGS((char_u *dict, char_u *pat, int dir, int flags, int thesaurus));
@@ -657,7 +654,8 @@ edit(cmdchar, startln, count)
 #ifdef FEAT_INS_EXPAND
 	/* Prepare for or stop CTRL-X mode.  This doesn't do completion, but
 	 * it does fix up the text when finishing completion. */
-	ins_compl_prep(c);
+	if (c != K_IGNORE)
+	    ins_compl_prep(c);
 #endif
 
 	/* CTRL-\ CTRL-N goes to Normal mode, CTRL-\ CTRL-G goes to mode
@@ -800,20 +798,6 @@ doESCkey:
 	    }
 	    continue;
 
-	case K_INS:	/* toggle insert/replace mode */
-	case K_KINS:
-	    ins_insert(replaceState);
-	    break;
-
-#ifdef FEAT_INS_EXPAND
-	case Ctrl_X:	/* Enter CTRL-X mode */
-	    ins_ctrl_x();
-	    break;
-#endif
-
-	case K_SELECT:	/* end of Select mode mapping - ignore */
-	    break;
-
 	case Ctrl_Z:	/* suspend when 'insertmode' set */
 	    if (!p_im)
 		goto normalchar;	/* insert CTRL-Z as normal char */
@@ -832,6 +816,14 @@ doESCkey:
 	    count = 0;
 	    goto doESCkey;
 
+	case K_INS:	/* toggle insert/replace mode */
+	case K_KINS:
+	    ins_insert(replaceState);
+	    break;
+
+	case K_SELECT:	/* end of Select mode mapping - ignore */
+	    break;
+
 #ifdef FEAT_SNIFF
 	case K_SNIFF:	/* Sniff command received */
 	    stuffcharReadbuff(K_SNIFF);
@@ -1112,6 +1104,10 @@ doESCkey:
 #endif
 
 #ifdef FEAT_INS_EXPAND
+	case Ctrl_X:	/* Enter CTRL-X mode */
+	    ins_ctrl_x();
+	    break;
+
 	case Ctrl_RSB:	/* Tag name completion after ^X */
 	    if (ctrl_x_mode != CTRL_X_TAGS)
 		goto normalchar;
@@ -1803,7 +1799,7 @@ vim_is_ctrl_x_key(c)
 		    || c == Ctrl_L || c == Ctrl_F || c == Ctrl_RSB
 		    || c == Ctrl_I || c == Ctrl_D || c == Ctrl_P
 		    || c == Ctrl_N || c == Ctrl_T || c == Ctrl_V
-		    || c == Ctrl_Q);
+		    || c == Ctrl_Q || c == Ctrl_U || c == Ctrl_O);
 	case CTRL_X_SCROLL:
 	    return (c == Ctrl_Y || c == Ctrl_E);
 	case CTRL_X_WHOLE_LINE:
@@ -1844,12 +1840,12 @@ vim_is_ctrl_x_key(c)
  * TODO: make this work for multi-byte characters.
  */
     int
-ins_compl_add_infercase(str, len, fname, dir, reuse)
+ins_compl_add_infercase(str, len, fname, dir, flags)
     char_u	*str;
     int		len;
     char_u	*fname;
     int		dir;
-    int		reuse;
+    int		flags;
 {
     int		has_lower = FALSE;
     int		was_letter = FALSE;
@@ -1900,30 +1896,35 @@ ins_compl_add_infercase(str, len, fname,
 	/* Copy the original case of the part we typed */
 	STRNCPY(IObuff, compl_orig_text, compl_length);
 
-	return ins_compl_add(IObuff, len, fname, dir, reuse);
-    }
-    return ins_compl_add(str, len, fname, dir, reuse);
+	return ins_compl_add(IObuff, len, fname, dir, flags);
+    }
+    return ins_compl_add(str, len, fname, dir, flags);
 }
 
 /*
  * Add a match to the list of matches.
  * If the given string is already in the list of completions, then return
  * FAIL, otherwise add it to the list and return OK.  If there is an error,
- * maybe because alloc returns NULL, then RET_ERROR is returned -- webb.
+ * maybe because alloc() returns NULL, then RET_ERROR is returned -- webb.
+ *
+ * New:
+ * If the given string is already in the list of completions, then return
+ * NOTDONE, otherwise add it to the list and return OK.  If there is an error,
+ * maybe because alloc() returns NULL, then FAIL is returned -- webb.
  */
-    static int
-ins_compl_add(str, len, fname, dir, reuse)
+    int
+ins_compl_add(str, len, fname, dir, flags)
     char_u	*str;
     int		len;
     char_u	*fname;
     int		dir;
-    int		reuse;
+    int		flags;
 {
-    struct Completion *match;
+    compl_T	*match;
 
     ui_breakcheck();
     if (got_int)
-	return RET_ERROR;
+	return FAIL;
     if (len < 0)
 	len = (int)STRLEN(str);
 
@@ -1935,11 +1936,11 @@ ins_compl_add(str, len, fname, dir, reus
 	match = compl_first_match;
 	do
 	{
-	    if (    !(match->original & ORIGINAL_TEXT)
-		    && STRNCMP(match->str, str, (size_t)len) == 0
-		    && match->str[len] == NUL)
-		return FAIL;
-	    match = match->next;
+	    if (    !(match->cp_flags & ORIGINAL_TEXT)
+		    && STRNCMP(match->cp_str, str, (size_t)len) == 0
+		    && match->cp_str[len] == NUL)
+		return NOTDONE;
+	    match = match->cp_next;
 	} while (match != NULL && match != compl_first_match);
     }
 
@@ -1947,52 +1948,52 @@ ins_compl_add(str, len, fname, dir, reus
      * Allocate a new match structure.
      * Copy the values to the new match structure.
      */
-    match = (struct Completion *)alloc((unsigned)sizeof(struct Completion));
+    match = (compl_T *)alloc((unsigned)sizeof(compl_T));
     if (match == NULL)
-	return RET_ERROR;
-    match->number = -1;
-    if (reuse & ORIGINAL_TEXT)
-    {
-	match->number = 0;
-	match->str = compl_orig_text;
-    }
-    else if ((match->str = vim_strnsave(str, len)) == NULL)
+	return FAIL;
+    match->cp_number = -1;
+    if (flags & ORIGINAL_TEXT)
+    {
+	match->cp_number = 0;
+	match->cp_str = compl_orig_text;
+    }
+    else if ((match->cp_str = vim_strnsave(str, len)) == NULL)
     {
 	vim_free(match);
-	return RET_ERROR;
+	return FAIL;
     }
     /* match-fname is:
-     * - compl_curr_match->fname if it is a string equal to fname.
+     * - compl_curr_match->cp_fname if it is a string equal to fname.
      * - a copy of fname, FREE_FNAME is set to free later THE allocated mem.
      * - NULL otherwise.	--Acevedo */
-    if (fname && compl_curr_match && compl_curr_match->fname
-	      && STRCMP(fname, compl_curr_match->fname) == 0)
-	match->fname = compl_curr_match->fname;
-    else if (fname && (match->fname = vim_strsave(fname)) != NULL)
-	reuse |= FREE_FNAME;
+    if (fname && compl_curr_match && compl_curr_match->cp_fname
+	      && STRCMP(fname, compl_curr_match->cp_fname) == 0)
+	match->cp_fname = compl_curr_match->cp_fname;
+    else if (fname && (match->cp_fname = vim_strsave(fname)) != NULL)
+	flags |= FREE_FNAME;
     else
-	match->fname = NULL;
-    match->original = reuse;
+	match->cp_fname = NULL;
+    match->cp_flags = flags;
 
     /*
      * Link the new match structure in the list of matches.
      */
     if (compl_first_match == NULL)
-	match->next = match->prev = NULL;
+	match->cp_next = match->cp_prev = NULL;
     else if (dir == FORWARD)
     {
-	match->next = compl_curr_match->next;
-	match->prev = compl_curr_match;
+	match->cp_next = compl_curr_match->cp_next;
+	match->cp_prev = compl_curr_match;
     }
     else	/* BACKWARD */
     {
-	match->next = compl_curr_match;
-	match->prev = compl_curr_match->prev;
-    }
-    if (match->next)
-	match->next->prev = match;
-    if (match->prev)
-	match->prev->next = match;
+	match->cp_next = compl_curr_match;
+	match->cp_prev = compl_curr_match->cp_prev;
+    }
+    if (match->cp_next)
+	match->cp_next->cp_prev = match;
+    if (match->cp_prev)
+	match->cp_prev->cp_next = match;
     else	/* if there's nothing before, it is the first match */
 	compl_first_match = match;
     compl_curr_match = match;
@@ -2014,7 +2015,7 @@ ins_compl_add_matches(num_matches, match
     int		add_r = OK;
     int		ldir = dir;
 
-    for (i = 0; i < num_matches && add_r != RET_ERROR; i++)
+    for (i = 0; i < num_matches && add_r != FAIL; i++)
 	if ((add_r = ins_compl_add(matches[i], -1, NULL, ldir, 0)) == OK)
 	    /* if dir was BACKWARD then honor it just once */
 	    ldir = FORWARD;
@@ -2027,7 +2028,7 @@ ins_compl_add_matches(num_matches, match
     static int
 ins_compl_make_cyclic()
 {
-    struct Completion *match;
+    compl_T *match;
     int	    count = 0;
 
     if (compl_first_match != NULL)
@@ -2037,13 +2038,13 @@ ins_compl_make_cyclic()
 	 */
 	match = compl_first_match;
 	/* there's always an entry for the compl_orig_text, it doesn't count. */
-	while (match->next != NULL && match->next != compl_first_match)
-	{
-	    match = match->next;
+	while (match->cp_next != NULL && match->cp_next != compl_first_match)
+	{
+	    match = match->cp_next;
 	    ++count;
 	}
-	match->next = compl_first_match;
-	compl_first_match->prev = match;
+	match->cp_next = compl_first_match;
+	compl_first_match->cp_prev = match;
     }
     return count;
 }
@@ -2168,7 +2169,7 @@ ins_compl_dictionaries(dict, pat, dir, f
 			if (add_r == OK)
 			    /* if dir was BACKWARD then honor it just once */
 			    dir = FORWARD;
-			else if (add_r == RET_ERROR)
+			else if (add_r == FAIL)
 			    break;
 			/* avoid expensive call to vim_regexec() when at end
 			 * of line */
@@ -2176,7 +2177,7 @@ ins_compl_dictionaries(dict, pat, dir, f
 			    break;
 		    }
 		    line_breakcheck();
-		    ins_compl_check_keys();
+		    ins_compl_check_keys(50);
 		}
 		fclose(fp);
 	    }
@@ -2245,7 +2246,7 @@ find_word_end(ptr)
     static void
 ins_compl_free()
 {
-    struct Completion *match;
+    compl_T *match;
 
     vim_free(compl_pattern);
     compl_pattern = NULL;
@@ -2256,11 +2257,11 @@ ins_compl_free()
     do
     {
 	match = compl_curr_match;
-	compl_curr_match = compl_curr_match->next;
-	vim_free(match->str);
+	compl_curr_match = compl_curr_match->cp_next;
+	vim_free(match->cp_str);
 	/* several entries may use the same fname, free it just once. */
-	if (match->original & FREE_FNAME)
-	    vim_free(match->fname);
+	if (match->cp_flags & FREE_FNAME)
+	    vim_free(match->cp_fname);
 	vim_free(match);
     } while (compl_curr_match != NULL && compl_curr_match != compl_first_match);
     compl_first_match = compl_curr_match = NULL;
@@ -2280,6 +2281,7 @@ ins_compl_clear()
 
 /*
  * Prepare for Insert mode completion, or stop it.
+ * Called just after typing a character in Insert mode.
  */
     static void
 ins_compl_prep(c)
@@ -2430,7 +2432,7 @@ ins_compl_prep(c)
 		 * the redo buffer.  We add as few as necessary to delete
 		 * just the part of the original text that has changed.
 		 */
-		ptr = compl_curr_match->str;
+		ptr = compl_curr_match->cp_str;
 		p = compl_orig_text;
 		while (*p && *p == *ptr)
 		{
@@ -2647,20 +2649,20 @@ ins_compl_get_exp(ini, dir)
 						   certain type. */
     static buf_T	*ins_buf = NULL;	/* buffer being scanned */
 
-    pos_T		*pos;
-    char_u		**matches;
-    int			save_p_scs;
-    int			save_p_ws;
-    int			save_p_ic;
-    int			i;
-    int			num_matches;
-    int			len;
-    int			found_new_match;
-    int			type = ctrl_x_mode;
-    char_u		*ptr;
-    char_u		*dict = NULL;
-    int			dict_f = 0;
-    struct Completion	*old_match;
+    pos_T	*pos;
+    char_u	**matches;
+    int		save_p_scs;
+    int		save_p_ws;
+    int		save_p_ic;
+    int		i;
+    int		num_matches;
+    int		len;
+    int		found_new_match;
+    int		type = ctrl_x_mode;
+    char_u	*ptr;
+    char_u	*dict = NULL;
+    int		dict_f = 0;
+    compl_T	*old_match;
 
     if (!compl_started)
     {
@@ -2872,7 +2874,7 @@ ins_compl_get_exp(ini, dir)
 		p_ws = TRUE;
 	    for (;;)
 	    {
-		int	reuse = 0;
+		int	flags = 0;
 
 		/* ctrl_x_mode == CTRL_X_WHOLE_LINE || word-wise search that has
 		 * added a word that was at the beginning of the line */
@@ -2973,7 +2975,7 @@ ins_compl_get_exp(ini, dir)
 				    tmp_ptr = ptr + IOSIZE - len - 1;
 				STRNCPY(IObuff + len, ptr, tmp_ptr - ptr);
 				len += (int)(tmp_ptr - ptr);
-				reuse |= CONT_S_IPOS;
+				flags |= CONT_S_IPOS;
 			    }
 			    IObuff[len] = NUL;
 			    ptr = IObuff;
@@ -2984,7 +2986,7 @@ ins_compl_get_exp(ini, dir)
 		}
 		if (ins_compl_add_infercase(ptr, len,
 			    ins_buf == curbuf ?  NULL : ins_buf->b_sfname,
-							  dir, reuse) != FAIL)
+						       dir, flags) != NOTDONE)
 		{
 		    found_new_match = OK;
 		    break;
@@ -3024,7 +3026,7 @@ ins_compl_get_exp(ini, dir)
     /* If several matches were added (FORWARD) or the search failed and has
      * just been made cyclic then we have to move compl_curr_match to the next
      * or previous entry (if any) -- Acevedo */
-    compl_curr_match = dir == FORWARD ? old_match->next : old_match->prev;
+    compl_curr_match = dir == FORWARD ? old_match->cp_next : old_match->cp_prev;
     if (compl_curr_match == NULL)
 	compl_curr_match = old_match;
     return i;
@@ -3049,24 +3051,24 @@ ins_compl_delete()
     static void
 ins_compl_insert()
 {
-    ins_bytes(compl_shown_match->str + curwin->w_cursor.col - compl_col);
+    ins_bytes(compl_shown_match->cp_str + curwin->w_cursor.col - compl_col);
 }
 
 /*
  * Fill in the next completion in the current direction.
- * If allow_get_expansion is TRUE, then we may call ins_compl_get_exp() to get
- * more completions.  If it is FALSE, then we just do nothing when there are
- * no more completions in a given direction.  The latter case is used when we
- * are still in the middle of finding completions, to allow browsing through
- * the ones found so far.
+ * If "allow_get_expansion" is TRUE, then we may call ins_compl_get_exp() to
+ * get more completions.  If it is FALSE, then we just do nothing when there
+ * are no more completions in a given direction.  The latter case is used when
+ * we are still in the middle of finding completions, to allow browsing
+ * through the ones found so far.
  * Return the total number of matches, or -1 if still unknown -- webb.
  *
  * compl_curr_match is currently being used by ins_compl_get_exp(), so we use
  * compl_shown_match here.
  *
  * Note that this function may be called recursively once only.  First with
- * allow_get_expansion TRUE, which calls ins_compl_get_exp(), which in turn
- * calls this function with allow_get_expansion FALSE.
+ * "allow_get_expansion" TRUE, which calls ins_compl_get_exp(), which in turn
+ * calls this function with "allow_get_expansion" FALSE.
  */
     static int
 ins_compl_next(allow_get_expansion)
@@ -3081,10 +3083,10 @@ ins_compl_next(allow_get_expansion)
 	ins_compl_delete();
     }
     compl_pending = FALSE;
-    if (compl_shows_dir == FORWARD && compl_shown_match->next != NULL)
-	compl_shown_match = compl_shown_match->next;
-    else if (compl_shows_dir == BACKWARD && compl_shown_match->prev != NULL)
-	compl_shown_match = compl_shown_match->prev;
+    if (compl_shows_dir == FORWARD && compl_shown_match->cp_next != NULL)
+	compl_shown_match = compl_shown_match->cp_next;
+    else if (compl_shows_dir == BACKWARD && compl_shown_match->cp_prev != NULL)
+	compl_shown_match = compl_shown_match->cp_prev;
     else
     {
 	compl_pending = TRUE;
@@ -3119,15 +3121,15 @@ ins_compl_next(allow_get_expansion)
      * Show the file name for the match (if any)
      * Truncate the file name to avoid a wait for return.
      */
-    if (compl_shown_match->fname != NULL)
+    if (compl_shown_match->cp_fname != NULL)
     {
 	STRCPY(IObuff, "match in file ");
-	i = (vim_strsize(compl_shown_match->fname) + 16) - sc_col;
+	i = (vim_strsize(compl_shown_match->cp_fname) + 16) - sc_col;
 	if (i <= 0)
 	    i = 0;
 	else
 	    STRCAT(IObuff, "<");
-	STRCAT(IObuff, compl_shown_match->fname + i);
+	STRCAT(IObuff, compl_shown_match->cp_fname + i);
 	msg(IObuff);
 	redraw_cmdline = FALSE;	    /* don't overwrite! */
     }
@@ -3140,9 +3142,11 @@ ins_compl_next(allow_get_expansion)
  * that should change the currently displayed completion, or exit completion
  * mode.  Also, when compl_pending is TRUE, show a completion as soon as
  * possible. -- webb
+ * "frequency" specifies out of how many calls we actually check.
  */
     void
-ins_compl_check_keys()
+ins_compl_check_keys(frequency)
+    int		frequency;
 {
     static int	count = 0;
 
@@ -3154,7 +3158,7 @@ ins_compl_check_keys()
 	return;
 
     /* Only do this at regular intervals */
-    if (++count < CHECK_KEYS_TIME)
+    if (++count < frequency)
 	return;
     count = 0;
 
@@ -3577,7 +3581,7 @@ ins_complete(c)
     }
 
     /* we found no match if the list has only the "compl_orig_text"-entry */
-    if (compl_first_match == compl_first_match->next)
+    if (compl_first_match == compl_first_match->cp_next)
     {
 	edit_submode_extra = (compl_cont_status & CONT_ADDING)
 			&& compl_length > 1
@@ -3595,14 +3599,14 @@ ins_complete(c)
 	    compl_cont_status &= ~CONT_N_ADDS;
     }
 
-    if (compl_curr_match->original & CONT_S_IPOS)
+    if (compl_curr_match->cp_flags & CONT_S_IPOS)
 	compl_cont_status |= CONT_S_IPOS;
     else
 	compl_cont_status &= ~CONT_S_IPOS;
 
     if (edit_submode_extra == NULL)
     {
-	if (compl_curr_match->original & ORIGINAL_TEXT)
+	if (compl_curr_match->cp_flags & ORIGINAL_TEXT)
 	{
 	    edit_submode_extra = (char_u *)_("Back at original");
 	    edit_submode_highl = HLF_W;
@@ -3612,7 +3616,7 @@ ins_complete(c)
 	    edit_submode_extra = (char_u *)_("Word from other line");
 	    edit_submode_highl = HLF_COUNT;
 	}
-	else if (compl_curr_match->next == compl_curr_match->prev)
+	else if (compl_curr_match->cp_next == compl_curr_match->cp_prev)
 	{
 	    edit_submode_extra = (char_u *)_("The only match");
 	    edit_submode_highl = HLF_COUNT;
@@ -3620,64 +3624,68 @@ ins_complete(c)
 	else
 	{
 	    /* Update completion sequence number when needed. */
-	    if (compl_curr_match->number == -1)
+	    if (compl_curr_match->cp_number == -1)
 	    {
-		int		    number = 0;
-		struct Completion   *match;
+		int		number = 0;
+		compl_T		*match;
 
 		if (compl_direction == FORWARD)
 		{
 		    /* search backwards for the first valid (!= -1) number.
 		     * This should normally succeed already at the first loop
 		     * cycle, so it's fast! */
-		    for (match = compl_curr_match->prev; match != NULL
-			   && match != compl_first_match; match = match->prev)
-			if (match->number != -1)
+		    for (match = compl_curr_match->cp_prev; match != NULL
+			    && match != compl_first_match;
+						       match = match->cp_prev)
+			if (match->cp_number != -1)
 			{
-			    number = match->number;
+			    number = match->cp_number;
 			    break;
 			}
 		    if (match != NULL)
 			/* go up and assign all numbers which are not assigned
 			 * yet */
-			for (match = match->next; match
-				  && match->number == -1; match = match->next)
-			    match->number = ++number;
+			for (match = match->cp_next; match
+				&& match->cp_number == -1;
+						       match = match->cp_next)
+			    match->cp_number = ++number;
 		}
 		else /* BACKWARD */
 		{
 		    /* search forwards (upwards) for the first valid (!= -1)
 		     * number.  This should normally succeed already at the
 		     * first loop cycle, so it's fast! */
-		    for (match = compl_curr_match->next; match != NULL
-			   && match != compl_first_match; match = match->next)
-			if (match->number != -1)
+		    for (match = compl_curr_match->cp_next; match != NULL
+			    && match != compl_first_match;
+						       match = match->cp_next)
+			if (match->cp_number != -1)
 			{
-			    number = match->number;
+			    number = match->cp_number;
 			    break;
 			}
 		    if (match != NULL)
 			/* go down and assign all numbers which are not
 			 * assigned yet */
-			for (match = match->prev; match
-				  && match->number == -1; match = match->prev)
-			    match->number = ++number;
+			for (match = match->cp_prev; match
+				&& match->cp_number == -1;
+						       match = match->cp_prev)
+			    match->cp_number = ++number;
 		}
 	    }
 
 	    /* The match should always have a sequnce number now, this is just
 	     * a safety check. */
-	    if (compl_curr_match->number != -1)
+	    if (compl_curr_match->cp_number != -1)
 	    {
 		/* Space for 10 text chars. + 2x10-digit no.s */
 		static char_u match_ref[31];
 
 		if (compl_matches > 0)
 		    sprintf((char *)IObuff, _("match %d of %d"),
-				compl_curr_match->number, compl_matches);
+				compl_curr_match->cp_number, compl_matches);
 		else
 		    sprintf((char *)IObuff, _("match %d"),
-						    compl_curr_match->number);
+						 compl_curr_match->cp_number);
 		vim_strncpy(match_ref, IObuff, 30);
 		edit_submode_extra = match_ref;
 		edit_submode_highl = HLF_R;
@@ -3742,7 +3750,7 @@ quote_meta(dest, src, len)
 	}
 	if (dest != NULL)
 	    *dest++ = *src;
-#ifdef FEAT_MBYTE
+# ifdef FEAT_MBYTE
 	/* Copy remaining bytes of a multibyte character. */
 	if (has_mbyte)
 	{
@@ -3758,7 +3766,7 @@ quote_meta(dest, src, len)
 			*dest++ = *src;
 		}
 	}
-#endif
+# endif
     }
     if (dest != NULL)
 	*dest = NUL;
--- a/src/eval.c
+++ b/src/eval.c
@@ -460,6 +460,10 @@ static void f_call __ARGS((typval_T *arg
 static void f_char2nr __ARGS((typval_T *argvars, typval_T *rettv));
 static void f_cindent __ARGS((typval_T *argvars, typval_T *rettv));
 static void f_col __ARGS((typval_T *argvars, typval_T *rettv));
+#if defined(FEAT_INS_EXPAND)
+static void f_complete_add __ARGS((typval_T *argvars, typval_T *rettv));
+static void f_complete_check __ARGS((typval_T *argvars, typval_T *rettv));
+#endif
 static void f_confirm __ARGS((typval_T *argvars, typval_T *rettv));
 static void f_copy __ARGS((typval_T *argvars, typval_T *rettv));
 static void f_count __ARGS((typval_T *argvars, typval_T *rettv));
@@ -6690,6 +6694,10 @@ static struct fst
     {"char2nr",		1, 1, f_char2nr},
     {"cindent",		1, 1, f_cindent},
     {"col",		1, 1, f_col},
+#if defined(FEAT_INS_EXPAND)
+    {"complete_add",	1, 1, f_complete_add},
+    {"complete_check",	0, 0, f_complete_check},
+#endif
     {"confirm",		1, 4, f_confirm},
     {"copy",		1, 1, f_copy},
     {"count",		2, 4, f_count},
@@ -7871,6 +7879,41 @@ f_col(argvars, rettv)
     rettv->vval.v_number = col;
 }
 
+#if defined(FEAT_INS_EXPAND)
+/*
+ * "complete_add()" function
+ */
+/*ARGSUSED*/
+    static void
+f_complete_add(argvars, rettv)
+    typval_T	*argvars;
+    typval_T	*rettv;
+{
+    char_u	*s;
+
+    s = get_tv_string_chk(&argvars[0]);
+    if (s != NULL)
+	rettv->vval.v_number = ins_compl_add(s, -1, NULL, FORWARD, 0);
+}
+
+/*
+ * "complete_check()" function
+ */
+/*ARGSUSED*/
+    static void
+f_complete_check(argvars, rettv)
+    typval_T	*argvars;
+    typval_T	*rettv;
+{
+    int		saved = RedrawingDisabled;
+
+    RedrawingDisabled = 0;
+    ins_compl_check_keys(0);
+    rettv->vval.v_number = compl_interrupted;
+    RedrawingDisabled = saved;
+}
+#endif
+
 /*
  * "confirm(message, buttons[, default [, type]])" function
  */
--- a/src/proto/edit.pro
+++ b/src/proto/edit.pro
@@ -7,10 +7,11 @@ void change_indent __ARGS((int type, int
 void truncate_spaces __ARGS((char_u *line));
 void backspace_until_column __ARGS((int col));
 int vim_is_ctrl_x_key __ARGS((int c));
-int ins_compl_add_infercase __ARGS((char_u *str, int len, char_u *fname, int dir, int reuse));
+int ins_compl_add_infercase __ARGS((char_u *str, int len, char_u *fname, int dir, int flags));
+int ins_compl_add __ARGS((char_u *str, int len, char_u *fname, int dir, int flags));
 char_u *find_word_start __ARGS((char_u *ptr));
 char_u *find_word_end __ARGS((char_u *ptr));
-void ins_compl_check_keys __ARGS((void));
+void ins_compl_check_keys __ARGS((int frequency));
 int get_literal __ARGS((void));
 void insertchar __ARGS((int c, int flags, int second_indent));
 void auto_format __ARGS((int trailblank, int prev_line));
--- a/src/search.c
+++ b/src/search.c
@@ -4743,7 +4743,7 @@ search_line:
 		if (add_r == OK)
 		    /* if dir was BACKWARD then honor it just once */
 		    dir = FORWARD;
-		else if (add_r == RET_ERROR)
+		else if (add_r == FAIL)
 		    break;
 	    }
 	    else
@@ -4873,7 +4873,7 @@ exit_matched:
 	line_breakcheck();
 #ifdef FEAT_INS_EXPAND
 	if (action == ACTION_EXPAND)
-	    ins_compl_check_keys();
+	    ins_compl_check_keys(30);
 	if (got_int || compl_interrupted)
 #else
 	if (got_int)
--- a/src/tag.c
+++ b/src/tag.c
@@ -1382,7 +1382,7 @@ find_tags(pat, num_matches, matchesp, fl
 	    line_breakcheck();	    /* check for CTRL-C typed */
 #ifdef FEAT_INS_EXPAND
 	    if ((flags & TAG_INS_COMP))	/* Double brackets for gcc */
-		ins_compl_check_keys();
+		ins_compl_check_keys(30);
 	    if (got_int || compl_interrupted)
 #else
 	    if (got_int)
--- 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 (2005 Aug 4)"
-#define VIM_VERSION_LONG_DATE	"VIM - Vi IMproved 7.0aa ALPHA (2005 Aug 4, compiled "
+#define VIM_VERSION_LONG	"VIM - Vi IMproved 7.0aa ALPHA (2005 Aug 5)"
+#define VIM_VERSION_LONG_DATE	"VIM - Vi IMproved 7.0aa ALPHA (2005 Aug 5, compiled "