Update runtime files.
diff --git a/runtime/autoload/ada.vim b/runtime/autoload/ada.vim
index ffd0ff8..8f525f4 100644
--- a/runtime/autoload/ada.vim
+++ b/runtime/autoload/ada.vim
@@ -1,15 +1,15 @@
 "------------------------------------------------------------------------------
 "  Description: Perform Ada specific completion & tagging.
 "     Language: Ada (2005)
-"	   $Id$
+"	   $Id: ada.vim 887 2008-07-08 14:29:01Z krischik $
 "   Maintainer: Martin Krischik <krischik@users.sourceforge.net>
 "		Taylor Venable <taylor@metasyntax.net>
 "		Neil Bird <neil@fnxweb.com>
 "		Ned Okie <nokie@radford.edu>
-"      $Author$
-"	 $Date$
+"      $Author: krischik $
+"	 $Date: 2008-07-08 16:29:01 +0200 (Di, 08 Jul 2008) $
 "      Version: 4.6
-"    $Revision$
+"    $Revision: 887 $
 "     $HeadURL: https://gnuada.svn.sourceforge.net/svnroot/gnuada/trunk/tools/vim/autoload/ada.vim $
 "      History: 24.05.2006 MK Unified Headers
 "		26.05.2006 MK ' should not be in iskeyword.
diff --git a/runtime/autoload/adacomplete.vim b/runtime/autoload/adacomplete.vim
index 8db4351..2659f51 100644
--- a/runtime/autoload/adacomplete.vim
+++ b/runtime/autoload/adacomplete.vim
@@ -1,12 +1,12 @@
 "------------------------------------------------------------------------------
 "  Description: Vim Ada omnicompletion file
 "     Language:	Ada (2005)
-"	   $Id$
+"	   $Id: adacomplete.vim 887 2008-07-08 14:29:01Z krischik $
 "   Maintainer:	Martin Krischik
-"      $Author$
-"	 $Date$
+"      $Author: krischik $
+"	 $Date: 2008-07-08 16:29:01 +0200 (Di, 08 Jul 2008) $
 "      Version: 4.6
-"    $Revision$
+"    $Revision: 887 $
 "     $HeadURL: https://gnuada.svn.sourceforge.net/svnroot/gnuada/trunk/tools/vim/autoload/adacomplete.vim $
 "      History: 24.05.2006 MK Unified Headers
 "		26.05.2006 MK improved search for begin of word.
diff --git a/runtime/autoload/decada.vim b/runtime/autoload/decada.vim
index fb5400e..7741ff0 100644
--- a/runtime/autoload/decada.vim
+++ b/runtime/autoload/decada.vim
@@ -1,13 +1,13 @@
 "------------------------------------------------------------------------------
 "  Description: Vim Ada/Dec Ada compiler file
 "     Language: Ada (Dec Ada)
-"          $Id$
+"          $Id: decada.vim 887 2008-07-08 14:29:01Z krischik $
 "    Copyright: Copyright (C) 2006 Martin Krischik
 "   Maintainer:	Martin Krischik <krischik@users.sourceforge.net>
-"      $Author$
-"        $Date$
+"      $Author: krischik $
+"        $Date: 2008-07-08 16:29:01 +0200 (Di, 08 Jul 2008) $
 "      Version: 4.6      
-"    $Revision$
+"    $Revision: 887 $
 "     $HeadURL: https://gnuada.svn.sourceforge.net/svnroot/gnuada/trunk/tools/vim/autoload/decada.vim $
 "      History: 21.07.2006 MK New Dec Ada
 "               15.10.2006 MK Bram's suggestion for runtime integration
diff --git a/runtime/autoload/getscript.vim b/runtime/autoload/getscript.vim
index 5a466cb..6e01976 100644
--- a/runtime/autoload/getscript.vim
+++ b/runtime/autoload/getscript.vim
@@ -1,8 +1,8 @@
 " ---------------------------------------------------------------------
 " getscript.vim
 "  Author:	Charles E. Campbell, Jr.
-"  Date:	Jul 10, 2008
-"  Version:	31
+"  Date:	Dec 28, 2009
+"  Version:	32
 "  Installing:	:help glvs-install
 "  Usage:	:help glvs
 "
@@ -12,19 +12,24 @@
 " Initialization:	{{{1
 " if you're sourcing this file, surely you can't be
 " expecting vim to be in its vi-compatible mode!
+if exists("g:loaded_getscript")
+ finish
+endif
+let g:loaded_getscript= "v32"
 if &cp
  echoerr "GetLatestVimScripts is not vi-compatible; not loaded (you need to set nocp)"
  finish
 endif
+if v:version < 702
+ echohl WarningMsg
+ echo "***warning*** this version of getscript needs vim 7.2"
+ echohl Normal
+ finish
+endif
 let s:keepcpo = &cpo
 set cpo&vim
 "DechoTabOn
 
-if exists("g:loaded_getscript")
- finish
-endif
-let g:loaded_getscript= "v31"
-
 " ---------------------------
 " Global Variables: {{{1
 " ---------------------------
@@ -40,25 +45,6 @@
   let g:getscript_cygwin= 0
  endif
 endif
-" shell quoting character {{{2
-if exists("g:netrw_shq") && !exists("g:getscript_shq")
- let g:getscript_shq= g:netrw_shq
-elseif !exists("g:getscript_shq")
- if exists("&shq") && &shq != ""
-  let g:getscript_shq= &shq
- elseif exists("&sxq") && &sxq != ""
-  let g:getscript_shq= &sxq
- elseif has("win32") || has("win95") || has("win64") || has("win16")
-  if g:getscript_cygwin
-   let g:getscript_shq= "'"
-  else
-   let g:getscript_shq= '"'
-  endif
- else
-  let g:getscript_shq= "'"
- endif
-" call Decho("g:getscript_shq<".g:getscript_shq.">")
-endif
 
 " wget vs curl {{{2
 if !exists("g:GetLatestVimScripts_wget")
@@ -112,7 +98,9 @@
   endif
  endif
 
- if exists('$HOME') && isdirectory(expand("$HOME")."/".s:dotvim)
+ if exists("g:GetLatestVimScripts_autoinstalldir") && isdirectory(g:GetLatestVimScripts_autoinstalldir)
+  let s:autoinstall= g:GetLatestVimScripts_autoinstalldir"
+ elseif exists('$HOME') && isdirectory(expand("$HOME")."/".s:dotvim)
   let s:autoinstall= $HOME."/".s:dotvim
  endif
 " call Decho("s:autoinstall<".s:autoinstall.">")
@@ -165,7 +153,6 @@
 "   call Dret("GetLatestVimScripts : unable to find a GetLatest subdirectory")
    return
   endif
-
   if filewritable(datadir) != 2
    echoerr "(getLatestVimScripts) Your ".datadir." isn't writable"
 "   call Dret("GetLatestVimScripts : non-writable directory<".datadir.">")
@@ -182,21 +169,29 @@
 "   call Dret("GetLatestVimScripts : non-writable datafile<".datafile.">")
    return
   endif
+  " --------------------
+  " Passed sanity checks
+  " --------------------
+
 "  call Decho("datadir  <".datadir.">")
 "  call Decho("datafile <".datafile.">")
 
-  " don't let any events interfere (like winmanager's, taglist's, etc)
-  let eikeep= &ei
-  let hlskeep= &hls
-  set ei=all hls&vim
+  " don't let any event handlers interfere (like winmanager's, taglist's, etc)
+  let eikeep  = &ei
+  let hlskeep = &hls
+  let acdkeep = &acd
+  set ei=all hls&vim noacd
 
-  " record current directory, change to datadir, open split window with
-  " datafile
+  " Edit the datafile (ie. GetLatestVimScripts.dat):
+  " 1. record current directory (origdir),
+  " 2. change directory to datadir,
+  " 3. split window
+  " 4. edit datafile
   let origdir= getcwd()
 "  call Decho("exe cd ".fnameescape(substitute(datadir,'\','/','ge')))
   exe "cd ".fnameescape(substitute(datadir,'\','/','ge'))
   split
-"  call Decho("exe e ".fnameescape(substitute(datafile,'\','/','ge')))
+"  call Decho("exe  e ".fnameescape(substitute(datafile,'\','/','ge')))
   exe "e ".fnameescape(substitute(datafile,'\','/','ge'))
   res 1000
   let s:downloads = 0
@@ -207,69 +202,68 @@
 "  call Decho("searching plugins for GetLatestVimScripts dependencies")
   let lastline    = line("$")
 "  call Decho("lastline#".lastline)
-  let plugins     = split(globpath(&rtp,"plugin/*.vim"),'\n')
+  let firstdir    = substitute(&rtp,',.*$','','')
+  let plugins     = split(globpath(firstdir,"plugin/*.vim"),'\n')
+  let plugins     = plugins + split(globpath(firstdir,"AsNeeded/*.vim"),'\n')
   let foundscript = 0
-  let firstdir= ""
 
+  " this loop updates the GetLatestVimScripts.dat file
+  " with dependencies explicitly mentioned in the plugins
+  " via   GetLatestVimScripts: ... lines
+  " It reads the plugin script at the end of the GetLatestVimScripts.dat
+  " file, examines it, and then removes it.
   for plugin in plugins
+"   call Decho(" ")
 "   call Decho("plugin<".plugin.">")
 
-   " don't process plugins in system directories
-   if firstdir == ""
-    let firstdir= substitute(plugin,'[/\\][^/\\]\+$','','')
-"    call Decho("setting firstdir<".firstdir.">")
-   else
-    let curdir= substitute(plugin,'[/\\][^/\\]\+$','','')
-"    call Decho("curdir<".curdir.">")
-    if curdir != firstdir
-"     call Decho("skipping subsequent plugins: curdir<".curdir."> != firstdir<".firstdir.">")
-     break
-    endif
-   endif
-
    " read plugin in
    " evidently a :r creates a new buffer (the "#" buffer) that is subsequently unused -- bwiping it
    $
-"   call Decho(" ")
 "   call Decho(".dependency checking<".plugin."> line$=".line("$"))
-"   call Decho("exe silent r ".fnameescape(plugin))
+"   call Decho("..exe silent r ".fnameescape(plugin))
    exe "silent r ".fnameescape(plugin)
    exe "silent bwipe ".bufnr("#")
 
    while search('^"\s\+GetLatestVimScripts:\s\+\d\+\s\+\d\+','W') != 0
-    let newscript= substitute(getline("."),'^"\s\+GetLatestVimScripts:\s\+\d\+\s\+\d\+\s\+\(.*\)$','\1','e')
-    let llp1     = lastline+1
-"    call Decho("..newscript<".newscript.">")
+    let depscript   = substitute(getline("."),'^"\s\+GetLatestVimScripts:\s\+\d\+\s\+\d\+\s\+\(.*\)$','\1','e')
+    let depscriptid = substitute(getline("."),'^"\s\+GetLatestVimScripts:\s\+\(\d\+\)\s\+.*$','\1','')
+    let llp1        = lastline+1
+"    call Decho("..depscript<".depscript.">")
 
-    " don't process ""GetLatestVimScripts lines -- those that have been doubly-commented out
-    if newscript !~ '^"'
-     " found a "GetLatestVimScripts: # #" line in the script; check if its already in the datafile
-     let curline     = line(".")
-     let noai_script = substitute(newscript,'\s*:AutoInstall:\s*','','e')
-     exe llp1
-     let srchline    = search('\<'.noai_script.'\>','bW')
-"     call Decho("..noai_script<".noai_script."> srch=".srchline."curline#".line(".")." lastline#".lastline)
-
-     if srchline == 0
-      " found a new script to permanently include in the datafile
-      let keep_rega   = @a
-      let @a          = substitute(getline(curline),'^"\s\+GetLatestVimScripts:\s\+','','')
-      exe lastline."put a"
-      echomsg "Appending <".@a."> to ".datafile." for ".newscript
-"      call Decho("..APPEND (".noai_script.")<".@a."> to GetLatestVimScripts.dat")
-      let @a          = keep_rega
-      let lastline    = llp1
-      let curline     = curline     + 1
-      let foundscript = foundscript + 1
-"     else	" Decho
-"      call Decho("..found <".noai_script."> (already in datafile at line#".srchline.")")
-     endif
-
-     let curline = curline + 1
-     exe curline
+    " found a "GetLatestVimScripts: # #" line in the script;
+    " check if its already in the datafile by searching backwards from llp1,
+    " the (prior to reading in the plugin script) last line plus one of the GetLatestVimScripts.dat file,
+    " for the script-id with no wrapping allowed.
+    let curline     = line(".")
+    let noai_script = substitute(depscript,'\s*:AutoInstall:\s*','','e')
+    exe llp1
+    let srchline    = search('^\s*'.depscriptid.'\s\+\d\+\s\+.*$','bW')
+    if srchline == 0
+     " this second search is taken when, for example, a   0 0 scriptname  is to be skipped over
+     let srchline= search('\<'.noai_script.'\>','bW')
     endif
+"    call Decho("..noai_script<".noai_script."> depscriptid#".depscriptid." srchline#".srchline." curline#".line(".")." lastline#".lastline)
+
+    if srchline == 0
+     " found a new script to permanently include in the datafile
+     let keep_rega   = @a
+     let @a          = substitute(getline(curline),'^"\s\+GetLatestVimScripts:\s\+','','')
+     echomsg "Appending <".@a."> to ".datafile." for ".depscript
+"     call Decho("..Appending <".@a."> to ".datafile." for ".depscript)
+     exe lastline."put a"
+     let @a          = keep_rega
+     let lastline    = llp1
+     let curline     = curline     + 1
+     let foundscript = foundscript + 1
+"    else	" Decho
+"     call Decho("..found <".noai_script."> (already in datafile at line#".srchline.")")
+    endif
+
+    let curline = curline + 1
+    exe curline
    endwhile
 
+   " llp1: last line plus one
    let llp1= lastline + 1
 "   call Decho(".deleting lines: ".llp1.",$d")
    exe "silent! ".llp1.",$d"
@@ -282,7 +276,9 @@
    setlocal nomod
   endif
 
+  " --------------------------------------------------------------------
   " Check on out-of-date scripts using GetLatest/GetLatestVimScripts.dat
+  " --------------------------------------------------------------------
 "  call Decho("begin: checking out-of-date scripts using datafile<".datafile.">")
   setlocal lz
   1
@@ -322,8 +318,9 @@
 
   " restore events and current directory
   exe "cd ".fnameescape(substitute(origdir,'\','/','ge'))
-  let &ei= eikeep
-  let &hls= hlskeep
+  let &ei  = eikeep
+  let &hls = hlskeep
+  let &acd = acdkeep
   setlocal nolz
 "  call Dredir("BUFFER TEST (GetLatestVimScripts 2)","ls!")
 "  call Dret("GetLatestVimScripts : did ".s:downloads." downloads")
@@ -333,7 +330,7 @@
 "  GetOneScript: (Get Latest Vim Script) this function operates {{{1
 "    on the current line, interpreting two numbers and text as
 "    ScriptID, SourceID, and Filename.
-"    It downloads any scripts that have newer versions from vim.sf.net.
+"    It downloads any scripts that have newer versions from vim.sourceforge.net.
 fun! s:GetOneScript(...)
 "   call Dfunc("GetOneScript()")
 
@@ -391,6 +388,7 @@
 "   call Decho("fname   <".fname.">")
   endif
 
+  " plugin author protection from downloading his/her own scripts atop their latest work
   if scriptid == 0 || srcid == 0
    " When looking for :AutoInstall: lines, skip scripts that have   0 0 scriptname
    let @a= rega
@@ -416,21 +414,21 @@
 "  call Decho('considering <'.aicmmnt.'> scriptid='.scriptid.' srcid='.srcid)
   echo 'considering <'.aicmmnt.'> scriptid='.scriptid.' srcid='.srcid
 
-  " grab a copy of the plugin's vim.sf.net webpage
-  let scriptaddr = 'http://vim.sf.net/script.php?script_id='.scriptid
+  " grab a copy of the plugin's vim.sourceforge.net webpage
+  let scriptaddr = 'http://vim.sourceforge.net/script.php?script_id='.scriptid
   let tmpfile    = tempname()
   let v:errmsg   = ""
 
   " make up to three tries at downloading the description
   let itry= 1
   while itry <= 3
-"   call Decho("try#".itry." to download description of <".aicmmnt."> with addr=".scriptaddr)
+"   call Decho(".try#".itry." to download description of <".aicmmnt."> with addr=".scriptaddr)
    if has("win32") || has("win16") || has("win95")
-"    call Decho("new|exe silent r!".g:GetLatestVimScripts_wget." ".g:GetLatestVimScripts_options." ".s:Escape(tmpfile).' '.s:Escape(scriptaddr)."|bw!")
-    new|exe "silent r!".g:GetLatestVimScripts_wget." ".g:GetLatestVimScripts_options." ".s:Escape(tmpfile).' '.s:Escape(scriptaddr)|bw!
+"    call Decho(".new|exe silent r!".g:GetLatestVimScripts_wget." ".g:GetLatestVimScripts_options." ".shellescape(tmpfile).' '.shellescape(scriptaddr)."|bw!")
+    new|exe "silent r!".g:GetLatestVimScripts_wget." ".g:GetLatestVimScripts_options." ".shellescape(tmpfile).' '.shellescape(scriptaddr)|bw!
    else
-"    call Decho("exe silent !".g:GetLatestVimScripts_wget." ".g:GetLatestVimScripts_options." ".s:Escape(tmpfile)." ".s:Escape(scriptaddr))
-    exe "silent !".g:GetLatestVimScripts_wget." ".g:GetLatestVimScripts_options." ".s:Escape(tmpfile)." ".s:Escape(scriptaddr)
+"    call Decho(".exe silent !".g:GetLatestVimScripts_wget." ".g:GetLatestVimScripts_options." ".shellescape(tmpfile)." ".shellescape(scriptaddr))
+    exe "silent !".g:GetLatestVimScripts_wget." ".g:GetLatestVimScripts_options." ".shellescape(tmpfile)." ".shellescape(scriptaddr)
    endif
    if itry == 1
     exe "silent vsplit ".fnameescape(tmpfile)
@@ -495,8 +493,7 @@
   let latestsrcid = latestsrcid + 0
 "  call Decho("srcid=".srcid." latestsrcid=".latestsrcid." sname<".sname.">")
 
-  " has the plugin's most-recent srcid increased, which indicates
-  " that it has been updated
+  " has the plugin's most-recent srcid increased, which indicates that it has been updated
   if latestsrcid > srcid
 "   call Decho("[latestsrcid=".latestsrcid."] <= [srcid=".srcid."]: need to update <".sname.">")
 
@@ -506,65 +503,103 @@
     let sname= "NEW_".sname
    endif
 
+   " -----------------------------------------------------------------------------
    " the plugin has been updated since we last obtained it, so download a new copy
-"   call Decho("...downloading new <".sname.">")
-   echomsg "...downloading new <".sname.">"
+   " -----------------------------------------------------------------------------
+"   call Decho(".downloading new <".sname.">")
+   echomsg ".downloading new <".sname.">"
    if has("win32") || has("win16") || has("win95")
-"    call Decho("new|exe silent r!".g:GetLatestVimScripts_wget." ".g:GetLatestVimScripts_options." ".s:Escape(sname)." ".s:Escape('http://vim.sf.net/scripts/download_script.php?src_id='.latestsrcid)."|q")
-    new|exe "silent r!".g:GetLatestVimScripts_wget." ".g:GetLatestVimScripts_options." ".s:Escape(sname)." ".s:Escape('http://vim.sf.net/scripts/download_script.php?src_id='.latestsrcid)|q
+"    call Decho(".new|exe silent r!".g:GetLatestVimScripts_wget." ".g:GetLatestVimScripts_options." ".shellescape(sname)." ".shellescape('http://vim.sourceforge.net/scripts/download_script.php?src_id='.latestsrcid)."|q")
+    new|exe "silent r!".g:GetLatestVimScripts_wget." ".g:GetLatestVimScripts_options." ".shellescape(sname)." ".shellescape('http://vim.sourceforge.net/scripts/download_script.php?src_id='.latestsrcid)|q
    else
-"    call Decho("exe silent !".g:GetLatestVimScripts_wget." ".g:GetLatestVimScripts_options." ".s:Escape(sname)." ".s:Escape('http://vim.sf.net/scripts/download_script.php?src_id='))
-    exe "silent !".g:GetLatestVimScripts_wget." ".g:GetLatestVimScripts_options." ".s:Escape(sname)." ".s:Escape('http://vim.sf.net/scripts/download_script.php?src_id=').latestsrcid
+"    call Decho(".exe silent !".g:GetLatestVimScripts_wget." ".g:GetLatestVimScripts_options." ".shellescape(sname)." ".shellescape('http://vim.sourceforge.net/scripts/download_script.php?src_id='))
+    exe "silent !".g:GetLatestVimScripts_wget." ".g:GetLatestVimScripts_options." ".shellescape(sname)." ".shellescape('http://vim.sourceforge.net/scripts/download_script.php?src_id=').latestsrcid
    endif
 
+   " --------------------------------------------------------------------------
    " AutoInstall: only if doautoinstall has been requested by the plugin itself
+   " --------------------------------------------------------------------------
    if doautoinstall
-"    call Decho("attempting to do autoinstall: getcwd<".getcwd()."> filereadable(".sname.")=".filereadable(sname))
+"    call Decho(" ")
+"    call Decho("Autoinstall: getcwd<".getcwd()."> filereadable(".sname.")=".filereadable(sname))
     if filereadable(sname)
-"     call Decho("exe silent !".g:GetLatestVimScripts_mv." ".s:Escape(sname)." ".s:Escape(s:autoinstall))
-     exe "silent !".g:GetLatestVimScripts_mv." ".s:Escape(sname)." ".s:Escape(s:autoinstall)
+"     call Decho("<".sname."> is readable")
+"     call Decho("exe silent !".g:GetLatestVimScripts_mv." ".shellescape(sname)." ".shellescape(s:autoinstall))
+     exe "silent !".g:GetLatestVimScripts_mv." ".shellescape(sname)." ".shellescape(s:autoinstall)
      let curdir    = escape(substitute(getcwd(),'\','/','ge'),"|[]*'\" #")
      let installdir= curdir."/Installed"
      if !isdirectory(installdir)
       call mkdir(installdir)
      endif
-"    call Decho("exe cd ".fnameescape(s:autoinstall))
+"     call Decho("curdir<".curdir."> installdir<".installdir.">")
+"     call Decho("exe cd ".fnameescape(s:autoinstall))
      exe "cd ".fnameescape(s:autoinstall)
+
+     " determine target directory for moves
+     let firstdir= substitute(&rtp,',.*$','','')
+     let pname   = substitute(sname,'\..*','.vim','')
+"     call Decho("determine tgtdir: is <".firstdir.'/AsNeeded/'.pname." readable?")
+     if filereadable(firstdir.'/AsNeeded/'.pname)
+      let tgtdir= "AsNeeded"
+     else
+      let tgtdir= "plugin"
+     endif
+"     call Decho("tgtdir<".tgtdir.">  pname<".pname.">")
      
      " decompress
      if sname =~ '\.bz2$'
 "      call Decho("decompress: attempt to bunzip2 ".sname)
-      exe "silent !bunzip2 ".s:Escape(sname)
+      exe "silent !bunzip2 ".shellescape(sname)
       let sname= substitute(sname,'\.bz2$','','')
 "      call Decho("decompress: new sname<".sname."> after bunzip2")
      elseif sname =~ '\.gz$'
 "      call Decho("decompress: attempt to gunzip ".sname)
-      exe "silent !gunzip ".s:Escape(sname)
+      exe "silent !gunzip ".shellescape(sname)
       let sname= substitute(sname,'\.gz$','','')
 "      call Decho("decompress: new sname<".sname."> after gunzip")
+     else
+"      call Decho("no decompression needed")
      endif
      
      " distribute archive(.zip, .tar, .vba) contents
      if sname =~ '\.zip$'
 "      call Decho("dearchive: attempt to unzip ".sname)
-      exe "silent !unzip -o ".s:Escape(sname)
+      exe "silent !unzip -o ".shellescape(sname)
      elseif sname =~ '\.tar$'
 "      call Decho("dearchive: attempt to untar ".sname)
-      exe "silent !tar -xvf ".s:Escape(sname)
+      exe "silent !tar -xvf ".shellescape(sname)
      elseif sname =~ '\.vba$'
 "      call Decho("dearchive: attempt to handle a vimball: ".sname)
       silent 1split
+      if exists("g:vimball_home")
+       let oldvimballhome= g:vimball_home
+      endif
+      let g:vimball_home= s:autoinstall
       exe "silent e ".fnameescape(sname)
       silent so %
       silent q
+      if exists("oldvimballhome")
+       let g:vimball_home= oldvimballhome
+      else
+       unlet g:vimball_home
+      endif
+     else
+"      call Decho("no dearchiving needed")
      endif
      
+     " ---------------------------------------------
+     " move plugin to plugin/ or AsNeeded/ directory
+     " ---------------------------------------------
      if sname =~ '.vim$'
-"      call Decho("dearchive: attempt to simply move ".sname." to plugin")
-      exe "silent !".g:GetLatestVimScripts_mv." ".s:Escape(sname)." plugin"
+"      call Decho("dearchive: attempt to simply move ".sname." to ".tgtdir)
+      exe "silent !".g:GetLatestVimScripts_mv." ".shellescape(sname)." ".tgtdir
      else
 "      call Decho("dearchive: move <".sname."> to installdir<".installdir.">")
-      exe "silent !".g:GetLatestVimScripts_mv." ".s:Escape(sname)." ".installdir
+      exe "silent !".g:GetLatestVimScripts_mv." ".shellescape(sname)." ".installdir
+     endif
+     if tgtdir != "plugin"
+"      call Decho("exe silent !".g:GetLatestVimScripts_mv." plugin/".shellescape(pname)." ".tgtdir)
+      exe "silent !".g:GetLatestVimScripts_mv." plugin/".shellescape(pname)." ".tgtdir
      endif
      
      " helptags step
@@ -600,20 +635,6 @@
 endfun
 
 " ---------------------------------------------------------------------
-" s:Escape: makes a string safe&suitable for the shell {{{2
-fun! s:Escape(name)
-"  call Dfunc("s:Escape(name<".a:name.">)")
-  if exists("*shellescape")
-   " shellescape() was added by patch 7.0.111
-   let name= shellescape(a:name)
-  else
-   let name= g:getscript_shq . a:name . g:getscript_shq
-  endif
-"  call Dret("s:Escape ".name)
-  return name
-endfun
-
-" ---------------------------------------------------------------------
 " Restore Options: {{{1
 let &cpo= s:keepcpo
 unlet s:keepcpo
diff --git a/runtime/autoload/gnat.vim b/runtime/autoload/gnat.vim
index cebde8e..0def672 100644
--- a/runtime/autoload/gnat.vim
+++ b/runtime/autoload/gnat.vim
@@ -1,14 +1,14 @@
 "------------------------------------------------------------------------------
 "  Description: Vim Ada/GNAT compiler file
 "     Language: Ada (GNAT)
-"          $Id$
+"          $Id: gnat.vim 887 2008-07-08 14:29:01Z krischik $
 "    Copyright: Copyright (C) 2006 Martin Krischik
 "   Maintainer:	Martin Krischi <krischik@users.sourceforge.net>k
 "		Ned Okie <nokie@radford.edu>
-"      $Author$
-"        $Date$
+"      $Author: krischik $
+"        $Date: 2008-07-08 16:29:01 +0200 (Di, 08 Jul 2008) $
 "      Version: 4.6
-"    $Revision$
+"    $Revision: 887 $
 "     $HeadURL: https://gnuada.svn.sourceforge.net/svnroot/gnuada/trunk/tools/vim/autoload/gnat.vim $
 "      History: 24.05.2006 MK Unified Headers
 "		16.07.2006 MK Ada-Mode as vim-ball
diff --git a/runtime/autoload/netrw.vim b/runtime/autoload/netrw.vim
index 1e181d0..dff8afd 100644
--- a/runtime/autoload/netrw.vim
+++ b/runtime/autoload/netrw.vim
@@ -1,10 +1,10 @@
 " netrw.vim: Handles file transfer and remote directory listing across
 "            AUTOLOAD SECTION
-" Date:		Aug 08, 2008
-" Version:	132
+" Date:		Dec 28, 2009
+" Version:	136
 " Maintainer:	Charles E Campbell, Jr <NdrOchip@ScampbellPfamily.AbizM-NOSPAM>
 " GetLatestVimScripts: 1075 1 :AutoInstall: netrw.vim
-" Copyright:    Copyright (C) 1999-2008 Charles E. Campbell, Jr. {{{1
+" Copyright:    Copyright (C) 1999-2009 Charles E. Campbell, Jr. {{{1
 "               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,
@@ -22,12 +22,18 @@
 if &cp || exists("g:loaded_netrw")
   finish
 endif
+let g:loaded_netrw = "v136"
+if v:version < 702
+ echohl WarningMsg
+ echo "***warning*** this version of netrw needs vim 7.2"
+ echohl Normal
+ finish
+endif
 if !exists("s:NOTE")
  let s:NOTE    = 0
  let s:WARNING = 1
  let s:ERROR   = 2
 endif
-let g:loaded_netrw = "v132"
 
 " sanity checks
 if v:version < 700
@@ -45,25 +51,41 @@
 " ======================
 
 " ---------------------------------------------------------------------
+" NetrwInit: initializes variables if they haven't been defined {{{2
+"            Loosely,  varname = value.
+fun s:NetrwInit(varname,value)
+  if !exists(a:varname)
+   if type(a:value) == 0
+    exe "let ".a:varname."=".a:value
+   elseif type(a:value) == 1
+    exe "let ".a:varname."="."'".a:value."'"
+   else
+    exe "let ".a:varname."=".a:value
+   endif
+  endif
+endfun
+
+" ---------------------------------------------------------------------
 "  Netrw Constants: {{{2
-if !exists("g:NETRW_BOOKMARKMAX")
- let g:NETRW_BOOKMARKMAX= 0
-endif
-if !exists("g:NETRW_DIRHIST_CNT")
- let g:NETRW_DIRHIST_CNT= 0
-endif
+call s:NetrwInit("g:netrw_dirhist_cnt",0)
 if !exists("s:LONGLIST")
- let s:THINLIST = 0
- let s:LONGLIST = 1
- let s:WIDELIST = 2
- let s:TREELIST = 3
- let s:MAXLIST  = 4
+ call s:NetrwInit("s:THINLIST",0)
+ call s:NetrwInit("s:LONGLIST",1)
+ call s:NetrwInit("s:WIDELIST",2)
+ call s:NetrwInit("s:TREELIST",3)
+ call s:NetrwInit("s:MAXLIST" ,4)
 endif
 
 " ---------------------------------------------------------------------
 " Default values for netrw's global protocol variables {{{2
 if !exists("g:netrw_dav_cmd")
+ if executable("cadaver")
   let g:netrw_dav_cmd	= "cadaver"
+ elseif executable("curl")
+  let g:netrw_dav_cmd	= "curl"
+ else
+  let g:netrw_dav_cmd   = ""
+ endif
 endif
 if !exists("g:netrw_fetch_cmd")
  if executable("fetch")
@@ -78,35 +100,28 @@
 if !exists("g:netrw_http_cmd")
  if executable("elinks")
   let g:netrw_http_cmd = "elinks"
-  let g:netrw_http_xcmd= "-dump >"
+  call s:NetrwInit("g:netrw_http_xcmd","-source >")
  elseif executable("links")
   let g:netrw_http_cmd = "links"
-  let g:netrw_http_xcmd= "-dump >"
+  call s:NetrwInit("g:netrw_http_xcmd","-source >")
  elseif executable("curl")
-  let g:netrw_http_cmd	= "curl -o"
+  let g:netrw_http_cmd	= "curl"
+  call s:NetrwInit("g:netrw_http_xcmd","-o")
  elseif executable("wget")
-  let g:netrw_http_cmd	= "wget -q -O"
+  let g:netrw_http_cmd	= "wget"
+  call s:NetrwInit("g:netrw_http_xcmd","-q -O")
  elseif executable("fetch")
-  let g:netrw_http_cmd	= "fetch -o"
+  let g:netrw_http_cmd	= "fetch"
+  call s:NetrwInit("g:netrw_http_xcmd","-o")
  else
   let g:netrw_http_cmd	= ""
  endif
 endif
-if !exists("g:netrw_rcp_cmd")
-  let g:netrw_rcp_cmd	= "rcp"
-endif
-if !exists("g:netrw_rsync_cmd")
-  let g:netrw_rsync_cmd	= "rsync"
-endif
-if !exists("g:netrw_scp_cmd")
-  let g:netrw_scp_cmd	= "scp -q"
-endif
-if !exists("g:netrw_sftp_cmd")
-  let g:netrw_sftp_cmd	= "sftp"
-endif
-if !exists("g:netrw_ssh_cmd")
- let g:netrw_ssh_cmd= "ssh"
-endif
+call s:NetrwInit("g:netrw_rcp_cmd"  , "rcp")
+call s:NetrwInit("g:netrw_rsync_cmd", "rsync")
+call s:NetrwInit("g:netrw_scp_cmd"  , "scp -q")
+call s:NetrwInit("g:netrw_sftp_cmd" , "sftp")
+call s:NetrwInit("g:netrw_ssh_cmd"  , "ssh")
 
 if (has("win32") || has("win95") || has("win64") || has("win16"))
   \ && exists("g:netrw_use_nt_rcp")
@@ -134,40 +149,24 @@
  endif
 endif
 " Default values - a-c ---------- {{{3
-if !exists("g:netrw_alto")
- let g:netrw_alto= &sb
-endif
-if !exists("g:netrw_altv")
- let g:netrw_altv= &spr
-endif
-if !exists("g:netrw_browse_split")
- let g:netrw_browse_split= 0
-endif
-if !exists("g:netrw_chgwin")
- let g:netrw_chgwin    = -1
-endif
-if !exists("g:netrw_compress")
- let g:netrw_compress= "gzip"
-endif
-if !exists("g:netrw_ctags")
- let g:netrw_ctags= "ctags"
+call s:NetrwInit("g:netrw_alto"        , &sb)
+call s:NetrwInit("g:netrw_altv"        , &spr)
+call s:NetrwInit("g:netrw_banner"      , 1)
+call s:NetrwInit("g:netrw_browse_split", 0)
+call s:NetrwInit("g:netrw_chgwin"      , -1)
+call s:NetrwInit("g:netrw_compress"    , "gzip")
+call s:NetrwInit("g:netrw_ctags"       , "ctags")
+if !exists("g:netrw_cursorline")
+ let g:netrw_cursorline= 1
+ let s:netrw_usercul   = &cursorline
+ let s:netrw_usercuc   = &cursorcolumn
 endif
 " Default values - d-g ---------- {{{3
-if !exists("g:NETRW_DIRHIST_CNT")
- let g:NETRW_DIRHIST_CNT= 0
-endif
-if !exists("g:netrw_decompress")
- let g:netrw_decompress= { ".gz" : "gunzip" , ".bz2" : "bunzip2" , ".zip" : "unzip" , ".tar" : "tar -xf"}
-endif
-if !exists("g:netrw_dirhistmax")
- let g:netrw_dirhistmax= 10
-endif
-if !exists("g:netrw_fastbrowse")
- let g:netrw_fastbrowse= 1
-endif
-if !exists("g:netrw_ftp_browse_reject")
- let g:netrw_ftp_browse_reject='^total\s\+\d\+$\|^Trying\s\+\d\+.*$\|^KERBEROS_V\d rejected\|^Security extensions not\|No such file\|: connect to address [0-9a-fA-F:]*: No route to host$'
-endif
+call s:NetrwInit("g:netrw_dirhist_cnt"      , 0)
+call s:NetrwInit("g:netrw_decompress"       , '{ ".gz" : "gunzip", ".bz2" : "bunzip2", ".zip" : "unzip", ".tar" : "tar -xf"}')
+call s:NetrwInit("g:netrw_dirhistmax"       , 10)
+call s:NetrwInit("g:netrw_fastbrowse"       , 1)
+call s:NetrwInit("g:netrw_ftp_browse_reject", '^total\s\+\d\+$\|^Trying\s\+\d\+.*$\|^KERBEROS_V\d rejected\|^Security extensions not\|No such file\|: connect to address [0-9a-fA-F:]*: No route to host$')
 if !exists("g:netrw_ftp_list_cmd")
  if has("unix") || (exists("g:netrw_cygwin") && g:netrw_cygwin)
   let g:netrw_ftp_list_cmd     = "ls -lF"
@@ -179,13 +178,9 @@
   let g:netrw_ftp_sizelist_cmd = "dir"
  endif
 endif
-if !exists("g:netrw_ftpmode")
- let g:netrw_ftpmode= "binary"
-endif
+call s:NetrwInit("g:netrw_ftpmode",'binary')
 " Default values - h-lh ---------- {{{3
-if !exists("g:netrw_hide")
- let g:netrw_hide= 1
-endif
+call s:NetrwInit("g:netrw_hide",1)
 if !exists("g:netrw_ignorenetrc")
  if &shell =~ '\c\<\%(cmd\|4nt\)\.exe$'
   let g:netrw_ignorenetrc= 1
@@ -193,9 +188,7 @@
   let g:netrw_ignorenetrc= 0
  endif
 endif
-if !exists("g:netrw_keepdir")
- let g:netrw_keepdir= 1
-endif
+call s:NetrwInit("g:netrw_keepdir",1)
 if !exists("g:netrw_list_cmd")
  if g:netrw_scp_cmd =~ '^pscp' && executable("pscp")
   " provide a 'pscp' listing command
@@ -211,9 +204,7 @@
   let g:netrw_list_cmd= ""
  endif
 endif
-if !exists("g:netrw_list_hide")
- let g:netrw_list_hide= ""
-endif
+call s:NetrwInit("g:netrw_list_hide","")
 " Default values - lh-lz ---------- {{{3
 if !exists("g:netrw_localcopycmd")
  if has("win32") || has("win95") || has("win64") || has("win16")
@@ -228,9 +219,7 @@
   let g:netrw_localcopycmd= ""
  endif
 endif
-if !exists("g:netrw_local_mkdir")
- let g:netrw_local_mkdir= "mkdir"
-endif
+call s:NetrwInit("g:netrw_local_mkdir","mkdir")
 if !exists("g:netrw_localmovecmd")
  if has("win32") || has("win95") || has("win64") || has("win16")
   if g:netrw_cygwin
@@ -244,128 +233,66 @@
   let g:netrw_localmovecmd= ""
  endif
 endif
-if !exists("g:netrw_local_rmdir")
- let g:netrw_local_rmdir= "rmdir"
-endif
-if !exists("g:netrw_liststyle")
- let g:netrw_liststyle= s:THINLIST
-endif
+call s:NetrwInit("g:netrw_local_rmdir", "rmdir")
+call s:NetrwInit("g:netrw_liststyle"  , s:THINLIST)
+" sanity checks
 if g:netrw_liststyle < 0 || g:netrw_liststyle >= s:MAXLIST
- " sanity check
  let g:netrw_liststyle= s:THINLIST
 endif
 if g:netrw_liststyle == s:LONGLIST && g:netrw_scp_cmd !~ '^pscp'
  let g:netrw_list_cmd= g:netrw_list_cmd." -l"
 endif
 " Default values - m-r ---------- {{{3
-if !exists("g:netrw_markfileesc")
- let g:netrw_markfileesc= '*./[\~'
+call s:NetrwInit("g:netrw_markfileesc"   , '*./[\~')
+call s:NetrwInit("g:netrw_maxfilenamelen", 32)
+call s:NetrwInit("g:netrw_menu"          , 1)
+call s:NetrwInit("g:netrw_mkdir_cmd"     , g:netrw_ssh_cmd." USEPORT HOSTNAME mkdir")
+call s:NetrwInit("g:netrw_mousemaps"     , (exists("&mouse") && &mouse =~ '[anh]'))
+call s:NetrwInit("g:netrw_retmap"        , 0)
+if has("unix") || (exists("g:netrw_cygwin") && g:netrw_cygwin)
+ call s:NetrwInit("g:netrw_chgperm"       , "chmod PERM FILENAME")
+elseif has("win32") || has("win95") || has("win64") || has("win16")
+ call s:NetrwInit("g:netrw_chgperm"       , "cacls FILENAME /e /p PERM")
+else
+ call s:NetrwInit("g:netrw_chgperm"       , "chmod PERM FILENAME")
 endif
-if !exists("g:netrw_maxfilenamelen")
- let g:netrw_maxfilenamelen= 32
-endif
-if !exists("g:netrw_menu")
- let g:netrw_menu= 1
-endif
-if !exists("g:netrw_mkdir_cmd")
- let g:netrw_mkdir_cmd= g:netrw_ssh_cmd." USEPORT HOSTNAME mkdir"
-endif
-if !exists("g:netrw_mousemaps")
- if exists("&mouse") && &mouse =~ '[anh]'
-  let g:netrw_mousemaps= 1
- else
-  let g:netrw_mousemaps= 0
- endif
-endif
-if !exists("g:netrw_retmap")
- let g:netrw_retmap= 0
-endif
-if !exists("g:netrw_preview")
- let g:netrw_preview= 0
-endif
-if !exists("g:netrw_scpport")
- let g:netrw_scpport= "-P"
-endif
-if !exists("g:netrw_sshport")
- let g:netrw_sshport= "-p"
-endif
-if !exists("g:netrw_rename_cmd")
- let g:netrw_rename_cmd= g:netrw_ssh_cmd." USEPORT HOSTNAME mv"
-endif
-if !exists("g:netrw_rm_cmd")
- let g:netrw_rm_cmd    = g:netrw_ssh_cmd." USEPORT HOSTNAME rm"
-endif
-if !exists("g:netrw_rmdir_cmd")
- let g:netrw_rmdir_cmd = g:netrw_ssh_cmd." USEPORT HOSTNAME rmdir"
-endif
-if !exists("g:netrw_rmf_cmd")
- let g:netrw_rmf_cmd    = g:netrw_ssh_cmd." USEPORT HOSTNAME rm -f"
-endif
+call s:NetrwInit("g:netrw_preview"       , 0)
+call s:NetrwInit("g:netrw_scpport"       , "-P")
+call s:NetrwInit("g:netrw_sshport"       , "-p")
+call s:NetrwInit("g:netrw_rename_cmd"    , g:netrw_ssh_cmd." USEPORT HOSTNAME mv")
+call s:NetrwInit("g:netrw_rm_cmd"        , g:netrw_ssh_cmd." USEPORT HOSTNAME rm")
+call s:NetrwInit("g:netrw_rmdir_cmd"     , g:netrw_ssh_cmd." USEPORT HOSTNAME rmdir")
+call s:NetrwInit("g:netrw_rmf_cmd"       , g:netrw_ssh_cmd." USEPORT HOSTNAME rm -f")
 " Default values - s ---------- {{{3
- " set up shell quoting character
-if exists("g:netrw_silent") && g:netrw_silent != 0
- let s:netrw_silentxfer= "silent "
-else
- let s:netrw_silentxfer= ""
-endif
-if !exists("g:netrw_sort_by")
- " alternatives: date size
- let g:netrw_sort_by= "name"
-endif
-if !exists("g:netrw_sort_options")
- let g:netrw_sort_options= ""
-endif
-if !exists("g:netrw_sort_direction")
- " alternative: reverse  (z y x ...)
- let g:netrw_sort_direction= "normal"
-endif
+" g:netrw_sepchr: picking a character that doesn't appear in filenames that can be used to separate priority from filename
+call s:NetrwInit("g:netrw_sepchr"        , (&enc == "euc-jp")? "\<Char-0x01>" : "\<Char-0xff>")
+call s:NetrwInit("s:netrw_silentxfer"    , (exists("g:netrw_silent") && g:netrw_silent != 0)? "silent " : "")
+call s:NetrwInit("g:netrw_sort_by"       , "name") " alternatives: date                                      , size
+call s:NetrwInit("g:netrw_sort_options"  , "")
+call s:NetrwInit("g:netrw_sort_direction", "normal") " alternative: reverse  (z y x ...)
 if !exists("g:netrw_sort_sequence")
- let g:netrw_sort_sequence= '[\/]$,\.h$,\.c$,\.cpp$,*,\.o$,\.obj$,\.info$,\.swp$,\.bak$,\~$'
-endif
-if !exists("g:netrw_special_syntax")
- let g:netrw_special_syntax= 0
-endif
-if !exists("g:netrw_ssh_browse_reject")
-  let g:netrw_ssh_browse_reject='^total\s\+\d\+$'
-endif
-if !has("patch192")
- if !exists("g:netrw_use_noswf")
-  let g:netrw_use_noswf= 1
+ if has("unix")
+  let g:netrw_sort_sequence= '[\/]$,\<core\%(\.\d\+\)\=\>,\.h$,\.c$,\.cpp$,*,\.o$,\.obj$,\.info$,\.swp$,\.bak$,\~$'
+ else
+  let g:netrw_sort_sequence= '[\/]$,\.h$,\.c$,\.cpp$,*,\.o$,\.obj$,\.info$,\.swp$,\.bak$,\~$'
  endif
-else
-  let g:netrw_use_noswf= 0
 endif
+call s:NetrwInit("g:netrw_special_syntax"   , 0)
+call s:NetrwInit("g:netrw_ssh_browse_reject", '^total\s\+\d\+$')
+call s:NetrwInit("g:netrw_use_noswf"        , 0)
 " Default values - t-w ---------- {{{3
-if !exists("g:netrw_timefmt")
- let g:netrw_timefmt= "%c"
-endif
-if !exists("g:netrw_xstrlen")
- let g:netrw_xstrlen= 1
-endif
-if !exists("g:NetrwTopLvlMenu")
- let g:NetrwTopLvlMenu= "Netrw."
-endif
-if !exists("g:netrw_use_errorwindow")
- let g:netrw_use_errorwindow= 1
-endif
-if !exists("g:netrw_win95ftp")
- let g:netrw_win95ftp= 1
-endif
-if !exists("g:netrw_winsize")
- let g:netrw_winsize= ""
-endif
+call s:NetrwInit("g:netrw_timefmt","%c")
+call s:NetrwInit("g:netrw_xstrlen",0)
+call s:NetrwInit("g:NetrwTopLvlMenu","Netrw.")
+call s:NetrwInit("g:netrw_use_errorwindow",1)
+call s:NetrwInit("g:netrw_win95ftp",1)
+call s:NetrwInit("g:netrw_winsize","")
 " ---------------------------------------------------------------------
 " Default values for netrw's script variables: {{{2
-if !exists("g:netrw_fname_escape")
- let g:netrw_fname_escape= ' ?&;%'
-endif
-if !exists("g:netrw_glob_escape")
-  let g:netrw_glob_escape= '[]*?`{~$'
-endif
-if !exists("g:netrw_tmpfile_escape")
- let g:netrw_tmpfile_escape= ' &;'
-endif
-let s:netrw_map_escape = "<|\n\r\\\<C-V>\""
+call s:NetrwInit("g:netrw_fname_escape",' ?&;%')
+call s:NetrwInit("g:netrw_glob_escape",'[]*?`{~$')
+call s:NetrwInit("g:netrw_tmpfile_escape",' &;')
+call s:NetrwInit("s:netrw_map_escape","<|\n\r\\\<C-V>\"")
 
 " BufEnter event ignored by decho when following variable is true
 "  Has a side effect that doau BufReadPost doesn't work, so
@@ -384,7 +311,7 @@
 "             NetrwBrowse.
 "             vt: normally its "w:" or "s:" (a variable type)
 fun! s:NetrwOptionSave(vt)
-"  call Dfunc("s:NetrwOptionSave(vt<".a:vt.">) win#".winnr()." buf#".bufnr("%")."<".bufname(bufnr("%")).">")
+"  call Dfunc("s:NetrwOptionSave(vt<".a:vt.">) win#".winnr()." buf#".bufnr("%")."<".bufname(bufnr("%")).">"." winnr($)=".winnr("$"))
 
 "  call Decho(a:vt."netrw_optionsave".(exists("{a:vt}netrw_optionsave")? ("=".{a:vt}netrw_optionsave) : " doesn't exist"))
   if !exists("{a:vt}netrw_optionsave")
@@ -430,7 +357,7 @@
 " ------------------------------------------------------------------------
 " s:NetrwOptionRestore: restore options {{{2
 fun! s:NetrwOptionRestore(vt)
-"  call Dfunc("s:NetrwOptionRestore(vt<".a:vt.">) win#".winnr()." buf#".bufnr("%"))
+"  call Dfunc("s:NetrwOptionRestore(vt<".a:vt.">) win#".winnr()." buf#".bufnr("%")." winnr($)=".winnr("$"))
   if !exists("{a:vt}netrw_optionsave")
 "   call Decho("ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap)
 "   call Dret("s:NetrwOptionRestore : ".a:vt."netrw_optionsave doesn't exist")
@@ -503,8 +430,8 @@
 " ---------------------------------------------------------------------
 " s:NetrwSafeOptions: sets options to help netrw do its job {{{2
 fun! s:NetrwSafeOptions()
-"  call Dfunc("s:NetrwSafeOptions() win#".winnr()." buf#".bufnr("%")."<".bufname(bufnr("%")).">")
-"  call Decho("window's ft=".&ft)
+"  call Dfunc("s:NetrwSafeOptions() win#".winnr()." buf#".bufnr("%")."<".bufname(bufnr("%"))."> winnr($)=".winnr("$"))
+"  call Decho("win#".winnr()."'s ft=".&ft)
   setlocal cino=
   setlocal com=
   setlocal cpo-=aA
@@ -513,9 +440,16 @@
   setlocal fo=nroql2
   setlocal tw=0
   setlocal report=10000
+  setlocal isk+=@ isk+=* isk+=/
   if g:netrw_use_noswf && has("win32") && !has("win95")
    setlocal noswf
   endif
+
+  " allow the user to override safe options
+  if &ft == "netrw"
+   silent keepalt keepjumps doau FileType netrw
+  endif
+
 "  call Decho("fo=".&fo.(exists("&acd")? " acd=".&acd : " acd doesn't exist"))
 "  call Dret("s:NetrwSafeOptions")
 endfun
@@ -566,6 +500,16 @@
 "  call Dret("netrw#NetrwClean")
 endfun
 
+" ---------------------------------------------------------------------
+" netrw#Nread: {{{2
+fun! netrw#Nread(mode,fname)
+"  call Dfunc("netrw#Nread(mode=".a:mode." fname<".a:fname.">)")
+  call netrw#NetrwSavePosn()
+  call netrw#NetRead(a:mode,a:fname)
+  call netrw#NetrwRestorePosn()
+"  call Dret("netrw#Nread")
+endfun
+
 " ------------------------------------------------------------------------
 "  Netrw Transfer Functions: {{{1
 " ===============================
@@ -579,11 +523,11 @@
 fun! netrw#NetRead(mode,...)
 "  call Dfunc("netrw#NetRead(mode=".a:mode.",...) a:0=".a:0." ".g:loaded_netrw)
 
-  " save options {{{3
+  " NetRead: save options {{{3
   call s:NetrwOptionSave("w:")
   call s:NetrwSafeOptions()
 
-  " interpret mode into a readcmd {{{3
+  " NetRead: interpret mode into a readcmd {{{3
   if     a:mode == 0 " read remote file before current line
    let readcmd = "0r"
   elseif a:mode == 1 " read file after current line
@@ -599,7 +543,7 @@
   let ichoice = (a:0 == 0)? 0 : 1
 "  call Decho("readcmd<".readcmd."> ichoice=".ichoice)
 
-  " Get Temporary Filename {{{3
+  " NetRead: get temporary filename {{{3
   let tmpfile= s:GetTempfile("")
   if tmpfile == ""
 "   call Dret("netrw#NetRead : unable to get a tempfile!")
@@ -666,8 +610,12 @@
 "   call Decho("choice<" . choice . ">")
    let ichoice= ichoice + 1
 
-   " Determine method of read (ftp, rcp, etc) {{{3
+   " NetRead: Determine method of read (ftp, rcp, etc) {{{3
    call s:NetrwMethod(choice)
+   if !exists("b:netrw_method") || b:netrw_method < 0
+"    call Dfunc("netrw#NetRead : unsupported method")
+    return
+   endif
    let tmpfile= s:GetTempfile(b:netrw_fname) " apply correct suffix
 
    " Check if NetrwBrowse() should be handling this request
@@ -680,14 +628,14 @@
    endif
 
    " ============
-   " Perform Protocol-Based Read {{{3
+   " NetRead: Perform Protocol-Based Read {{{3
    " ===========================
    if exists("g:netrw_silent") && g:netrw_silent == 0 && &ch >= 1
     echo "(netrw) Processing your read request..."
    endif
 
    ".........................................
-   " rcp:  NetRead Method #1 {{{3
+   " NetRead: (rcp)  NetRead Method #1 {{{3
    if  b:netrw_method == 1 " read with rcp
 "    call Decho("read via rcp (method #1)")
    " ER: nothing done with g:netrw_uid yet?
@@ -709,12 +657,12 @@
     endif
    endif
 "   call Decho("executing: !".g:netrw_rcp_cmd." ".s:netrw_rcpmode." ".shellescape(uid_machine.":".b:netrw_fname,1)." ".shellescape(tmpfile,1))
-   exe s:netrw_silentxfer."!".g:netrw_rcp_cmd." ".s:netrw_rcpmode." ".shellescape(uid_machine.":".b:netrw_fname,1)." ".shellescape(tmpfile,1))
+   exe s:netrw_silentxfer."!".g:netrw_rcp_cmd." ".s:netrw_rcpmode." ".shellescape(uid_machine.":".b:netrw_fname,1)." ".shellescape(tmpfile,1)
    let result           = s:NetrwGetFile(readcmd, tmpfile, b:netrw_method)
    let b:netrw_lastfile = choice
 
    ".........................................
-   " ftp + <.netrc>:  NetRead Method #2 {{{3
+   " NetRead: (ftp + <.netrc>)  NetRead Method #2 {{{3
    elseif b:netrw_method  == 2		" read with ftp + <.netrc>
 "     call Decho("read via ftp+.netrc (method #2)")
      let netrw_fname= b:netrw_fname
@@ -745,7 +693,8 @@
      endif
      call s:SaveBufVars()
      bd!
-     if bufname("%") == "" && line("$") == 1 && getline("$") == ""
+     if bufname("%") == "" && getline("$") == "" && line('$') == 1
+      " needed when one sources a file in a nolbl setting window via ftp
       q!
      endif
      call s:RestoreBufVars()
@@ -753,7 +702,7 @@
      let b:netrw_lastfile = choice
 
    ".........................................
-   " ftp + machine,id,passwd,filename:  NetRead Method #3 {{{3
+   " NetRead: (ftp + machine,id,passwd,filename)  NetRead Method #3 {{{3
    elseif b:netrw_method == 3		" read with ftp + machine, id, passwd, and fname
     " Construct execution string (four lines) which will be passed through filter
 "    call Decho("read via ftp+mipf (method #3)")
@@ -809,7 +758,7 @@
     let b:netrw_lastfile = choice
 
    ".........................................
-   " scp: NetRead Method #4 {{{3
+   " NetRead: (scp) NetRead Method #4 {{{3
    elseif     b:netrw_method  == 4	" read with scp
 "    call Decho("read via scp (method #4)")
     if exists("g:netrw_port") && g:netrw_port != ""
@@ -817,13 +766,13 @@
     else
      let useport= ""
     endif
-"    call Decho("exe s:netrw_silentxfer.!".g:netrw_scp_cmd.useport." ".shellescape(g:netrw_machine.":".b:netrw_fname,1)." ".shellescape(tmpfile,1))
+"    call Decho("exe ".s:netrw_silentxfer."!".g:netrw_scp_cmd.useport." ".shellescape(g:netrw_machine.":".b:netrw_fname,1)." ".shellescape(tmpfile,1))
     exe s:netrw_silentxfer."!".g:netrw_scp_cmd.useport." ".shellescape(g:netrw_machine.":".b:netrw_fname,1)." ".shellescape(tmpfile,1)
     let result           = s:NetrwGetFile(readcmd, tmpfile, b:netrw_method)
     let b:netrw_lastfile = choice
 
    ".........................................
-   " http: NetRead Method #5 (wget) {{{3
+   " NetRead: (http) NetRead Method #5 (wget) {{{3
    elseif     b:netrw_method  == 5
 "    call Decho("read via http (method #5)")
     if g:netrw_http_cmd == ""
@@ -863,33 +812,43 @@
     setlocal ro
 
    ".........................................
-   " cadaver: NetRead Method #6 {{{3
+   " NetRead: (dav) NetRead Method #6 {{{3
    elseif     b:netrw_method  == 6
 "    call Decho("read via cadaver (method #6)")
 
-    " Construct execution string (four lines) which will be passed through filter
-    let netrw_fname= escape(b:netrw_fname,g:netrw_fname_escape)
-    new
-    setlocal ff=unix
-    if exists("g:netrw_port") && g:netrw_port != ""
-     put ='open '.g:netrw_machine.' '.g:netrw_port
-    else
-     put ='open '.g:netrw_machine
+    if !executable(g:netrw_dav_cmd)
+     call netrw#ErrorMsg(s:ERROR,g:netrw_dav_cmd." is not executable",73)
+"     call Dret("netrw#NetRead : ".g:netrw_dav_cmd." not executable")
+     return
     endif
-    put ='user '.g:netrw_uid.' '.s:netrw_passwd
-    put ='get '.netrw_fname.' '.tmpfile
-    put ='quit'
+    if g:netrw_dav_cmd =~ "curl"
+"     call Decho("exe ".s:netrw_silentxfer."!".g:netrw_dav_cmd." ".shellescape("dav://".g:netrw_machine.b:netrw_fname,1)." ".shellescape(tmpfile,1))
+     exe s:netrw_silentxfer."!".g:netrw_dav_cmd." ".shellescape("dav://".g:netrw_machine.b:netrw_fname,1)." ".shellescape(tmpfile,1)
+    else
+     " Construct execution string (four lines) which will be passed through filter
+     let netrw_fname= escape(b:netrw_fname,g:netrw_fname_escape)
+     new
+     setlocal ff=unix
+     if exists("g:netrw_port") && g:netrw_port != ""
+      put ='open '.g:netrw_machine.' '.g:netrw_port
+     else
+      put ='open '.g:netrw_machine
+     endif
+     put ='user '.g:netrw_uid.' '.s:netrw_passwd
+     put ='get '.netrw_fname.' '.tmpfile
+     put ='quit'
 
-    " perform cadaver operation:
-    norm! 1Gdd
+     " perform cadaver operation:
+     norm! 1Gdd
 "    call Decho("executing: %!".g:netrw_dav_cmd)
-    exe s:netrw_silentxfer."%!".g:netrw_dav_cmd
-    bd!
+     exe s:netrw_silentxfer."%!".g:netrw_dav_cmd
+     bd!
+    endif
     let result           = s:NetrwGetFile(readcmd, tmpfile, b:netrw_method)
     let b:netrw_lastfile = choice
 
    ".........................................
-   " rsync: NetRead Method #7 {{{3
+   " NetRead: (rsync) NetRead Method #7 {{{3
    elseif     b:netrw_method  == 7
 "    call Decho("read via rsync (method #7)")
 "    call Decho("exe ".s:netrw_silentxfer."!".g:netrw_rsync_cmd." ".shellescape(g:netrw_machine.":".b:netrw_fname,1)." ".shellescape(tmpfile,1))
@@ -898,7 +857,7 @@
     let b:netrw_lastfile = choice
 
    ".........................................
-   " fetch: NetRead Method #8 {{{3
+   " NetRead: (fetch) NetRead Method #8 {{{3
    "    fetch://[user@]host[:http]/path
    elseif     b:netrw_method  == 8
 "    call Decho("read via fetch (method #8)")
@@ -928,7 +887,7 @@
     setlocal ro
 
    ".........................................
-   " sftp: NetRead Method #9 {{{3
+   " NetRead: (sftp) NetRead Method #9 {{{3
    elseif     b:netrw_method  == 9
 "    call Decho("read via sftp (method #9)")
 "    call Decho("exe ".s:netrw_silentxfer."!".g:netrw_sftp_cmd." ".shellescape(g:netrw_machine.":".b:netrw_fname,1)." ".tmpfile)
@@ -937,13 +896,13 @@
     let b:netrw_lastfile = choice
 
    ".........................................
-   " Complain {{{3
+   " NetRead: Complain {{{3
    else
     call netrw#ErrorMsg(s:WARNING,"unable to comply with your request<" . choice . ">",8)
    endif
   endwhile
 
-  " cleanup {{{3
+  " NetRead: cleanup {{{3
   if exists("b:netrw_method")
 "   call Decho("cleanup b:netrw_method and b:netrw_fname")
    unlet b:netrw_method
@@ -951,7 +910,7 @@
   endif
   if s:FileReadable(tmpfile) && tmpfile !~ '.tar.bz2$' && tmpfile !~ '.tar.gz$' && tmpfile !~ '.zip' && tmpfile !~ '.tar' && readcmd != 't'
 "   call Decho("cleanup by deleting tmpfile<".tmpfile.">")
-   call s:NetrwDelete(fnameescape(tmpfile))
+   call s:NetrwDelete(tmpfile)
   endif
   call s:NetrwOptionRestore("w:")
 
@@ -963,12 +922,12 @@
 fun! netrw#NetWrite(...) range
 "  call Dfunc("netrw#NetWrite(a:0=".a:0.") ".g:loaded_netrw)
 
-  " option handling
+  " NetWrite: option handling {{{3
   let mod= 0
   call s:NetrwOptionSave("w:")
   call s:NetrwSafeOptions()
 
-  " Get Temporary Filename {{{3
+  " NetWrite: Get Temporary Filename {{{3
   let tmpfile= s:GetTempfile("")
   if tmpfile == ""
 "   call Dret("netrw#NetWrite : unable to get a tempfile!")
@@ -1007,7 +966,7 @@
    0file!
   endif
 
-  " While choice loop: {{{3
+  " NetWrite: while choice loop: {{{3
   while ichoice <= a:0
 
    " Process arguments: {{{4
@@ -1065,9 +1024,13 @@
 
    " Determine method of write (ftp, rcp, etc) {{{4
    call s:NetrwMethod(choice)
+   if !exists("b:netrw_method") || b:netrw_method < 0
+"    call Dfunc("netrw#NetWrite : unsupported method")
+    return
+   endif
 
    " =============
-   " Perform Protocol-Based Write {{{4
+   " NetWrite: Perform Protocol-Based Write {{{3
    " ============================
    if exists("g:netrw_silent") && g:netrw_silent == 0 && &ch >= 1
     echo "(netrw) Processing your write request..."
@@ -1075,7 +1038,7 @@
    endif
 
    ".........................................
-   " rcp: NetWrite Method #1 {{{4
+   " NetWrite: (rcp) NetWrite Method #1 {{{3
    if  b:netrw_method == 1
 "    call Decho("write via rcp (method #1)")
     if s:netrw_has_nt_rcp == 1
@@ -1096,11 +1059,17 @@
     let b:netrw_lastfile = choice
 
    ".........................................
-   " ftp + <.netrc>: NetWrite Method #2 {{{4
+   " NetWrite: (ftp + <.netrc>) NetWrite Method #2 {{{3
    elseif b:netrw_method == 2
 "    call Decho("write via ftp+.netrc (method #2)")
-    let netrw_fname= b:netrw_fname
-    new
+    let netrw_fname = b:netrw_fname
+
+    " formerly just a "new...bd!", that changed the window sizes when equalalways.  Using enew workaround instead
+    let bhkeep      = &l:bh
+    let curbuf      = bufnr("%")
+    setlocal bh=hide
+    enew
+
 "    call Decho("filter input window#".winnr())
     setlocal ff=unix
     put =g:netrw_ftpmode
@@ -1126,17 +1095,29 @@
      endif
      let mod=1
     endif
-    bd!
+
+    " remove enew buffer (quietly)
+    let filtbuf= bufnr("%")
+    exe curbuf."b!"
+    let &l:bh            = bhkeep
+    exe filtbuf."bw!"
+
     let b:netrw_lastfile = choice
 
    ".........................................
-   " ftp + machine, id, passwd, filename: NetWrite Method #3 {{{4
+   " NetWrite: (ftp + machine, id, passwd, filename) NetWrite Method #3 {{{3
    elseif b:netrw_method == 3
-    " Construct execution string (four lines) which will be passed through filter
+    " Construct execution string (three or more lines) which will be passed through filter
 "    call Decho("read via ftp+mipf (method #3)")
-    let netrw_fname= b:netrw_fname
-    new
+    let netrw_fname = b:netrw_fname
+    let bhkeep      = &l:bh
+
+    " formerly just a "new...bd!", that changed the window sizes when equalalways.  Using enew workaround instead
+    let curbuf      = bufnr("%")
+    setlocal bh=hide
+    enew
     setlocal ff=unix
+
     if exists("g:netrw_port") && g:netrw_port != ""
      put ='open '.g:netrw_machine.' '.g:netrw_port
 "     call Decho("filter input: ".getline('.'))
@@ -1153,6 +1134,12 @@
      put ='user \"'.g:netrw_uid.'\" \"'.s:netrw_passwd.'\"'
 "     call Decho("filter input: ".getline('.'))
     endif
+    put =g:netrw_ftpmode
+"    call Decho("filter input: ".getline('$'))
+    if exists("g:netrw_ftpextracmd")
+     put =g:netrw_ftpextracmd
+"     call Decho("filter input: ".getline("$"))
+    endif
     put ='put \"'.tmpfile.'\" \"'.netrw_fname.'\"'
 "    call Decho("filter input: ".getline('.'))
     " save choice/id/password for future use
@@ -1172,10 +1159,15 @@
      endif
      let mod=1
     endif
-    bd!
+
+    " remove enew buffer (quietly)
+    let filtbuf= bufnr("%")
+    exe curbuf."b!"
+    let &l:bh= bhkeep
+    exe filtbuf."bw!"
 
    ".........................................
-   " scp: NetWrite Method #4 {{{4
+   " NetWrite: (scp) NetWrite Method #4 {{{3
    elseif     b:netrw_method == 4
 "    call Decho("write via scp (method #4)")
     if exists("g:netrw_port") && g:netrw_port != ""
@@ -1188,7 +1180,7 @@
     let b:netrw_lastfile = choice
 
    ".........................................
-   " http: NetWrite Method #5 {{{4
+   " NetWrite: (http) NetWrite Method #5 {{{3
    elseif     b:netrw_method == 5
 "    call Decho("write via http (method #5)")
     if !exists("g:netrw_quiet")
@@ -1196,13 +1188,19 @@
     endif
 
    ".........................................
-   " dav: NetWrite Method #6 (cadaver) {{{4
+   " NetWrite: (dav) NetWrite Method #6 (cadaver) {{{3
    elseif     b:netrw_method == 6
 "    call Decho("write via cadaver (method #6)")
 
     " Construct execution string (four lines) which will be passed through filter
-    let netrw_fname= escape(b:netrw_fname,g:netrw_fname_escape)
-    new
+    let netrw_fname = escape(b:netrw_fname,g:netrw_fname_escape)
+    let bhkeep      = &l:bh
+
+    " formerly just a "new...bd!", that changed the window sizes when equalalways.  Using enew workaround instead
+    let curbuf      = bufnr("%")
+    setlocal bh=hide
+    enew
+
     setlocal ff=unix
     if exists("g:netrw_port") && g:netrw_port != ""
      put ='open '.g:netrw_machine.' '.g:netrw_port
@@ -1218,11 +1216,17 @@
     norm! 1Gdd
 "    call Decho("executing: %!".g:netrw_dav_cmd)
     exe s:netrw_silentxfer."%!".g:netrw_dav_cmd
-    bd!
+
+    " remove enew buffer (quietly)
+    let filtbuf= bufnr("%")
+    exe curbuf."b!"
+    let &l:bh            = bhkeep
+    exe filtbuf."bw!"
+
     let b:netrw_lastfile = choice
 
    ".........................................
-   " rsync: NetWrite Method #7 {{{4
+   " NetWrite: (rsync) NetWrite Method #7 {{{3
    elseif     b:netrw_method == 7
 "    call Decho("write via rsync (method #7)")
 "    call Decho("executing: !".g:netrw_rsync_cmd." ".shellescape(tmpfile,1)." ".shellescape(g:netrw_machine.":".b:netrw_fname,1))
@@ -1230,7 +1234,7 @@
     let b:netrw_lastfile = choice
 
    ".........................................
-   " sftp: NetWrite Method #9 {{{4
+   " NetWrite: (sftp) NetWrite Method #9 {{{3
    elseif     b:netrw_method == 9
 "    call Decho("read via sftp (method #9)")
     let netrw_fname= escape(b:netrw_fname,g:netrw_fname_escape)
@@ -1239,24 +1243,32 @@
     else
      let uid_machine = g:netrw_machine
     endif
-    new
+
+    " formerly just a "new...bd!", that changed the window sizes when equalalways.  Using enew workaround instead
+    let bhkeep = &l:bh
+    let curbuf = bufnr("%")
+    setlocal bh=hide
+    enew
+
     setlocal ff=unix
-    put ='put \"'.escape(tmpfile,'\').'\" '.netrw_fname
+    call setline(1,'put "'.escape(tmpfile,'\').'" '.netrw_fname)
 "    call Decho("filter input: ".getline('.'))
-    norm! 1Gdd
 "    call Decho("executing: %!".g:netrw_sftp_cmd.' '.shellescape(uid_machine,1))
     exe s:netrw_silentxfer."%!".g:netrw_sftp_cmd.' '.shellescape(uid_machine,1)
-    bd!
-    let b:netrw_lastfile= choice
+    let filtbuf= bufnr("%")
+    exe curbuf."b!"
+    let &l:bh            = bhkeep
+    exe filtbuf."bw!"
+    let b:netrw_lastfile = choice
 
    ".........................................
-   " Complain {{{4
+   " NetWrite: Complain {{{3
    else
     call netrw#ErrorMsg(s:WARNING,"unable to comply with your request<" . choice . ">",17)
    endif
   endwhile
 
-  " Cleanup: {{{3
+  " NetWrite: Cleanup: {{{3
 "  call Decho("cleanup")
   if s:FileReadable(tmpfile)
 "   call Decho("tmpfile<".tmpfile."> readable, will now delete it")
@@ -1269,6 +1281,7 @@
    let &mod= mod
   endif
 
+  " restore equalalways
 "  call Dret("netrw#NetWrite")
 endfun
 
@@ -1370,11 +1383,7 @@
    " rename buffer back to remote filename
 "   call Decho("exe silent! keepalt file ".fnameescape(rfile))
    exe "silent! keepalt file ".fnameescape(rfile)
-   if a:method == 5
-    set ft=html
-   else
-    filetype detect
-   endif
+   filetype detect
 "   call Dredir("renamed buffer back to remote filename<".rfile."> : expand(%)<".expand("%").">","ls!")
    let line1 = 1
    let line2 = line("$")
@@ -1406,7 +1415,7 @@
 "   call Decho("NetReadFixup() not called, doesn't exist  (line1=".line1." line2=".line2.")")
   endif
 
-  if has("gui") && has("menu") && has("gui_running") && &go =~ 'm'
+  if has("gui") && has("menu") && has("gui_running") && &go =~ 'm' && g:netrw_menu
    " update the Buffers menu
    call s:UpdateBuffersMenu()
   endif
@@ -1422,18 +1431,34 @@
 
 " ------------------------------------------------------------------------
 " s:NetrwMethod:  determine method of transfer {{{2
-"  method == 1: rcp
-"	     2: ftp + <.netrc>
-"	     3: ftp + machine, id, password, and [path]filename
-"	     4: scp
-"	     5: http (wget)
-"	     6: cadaver
-"	     7: rsync
-"	     8: fetch
-"	     9: sftp
-fun! s:NetrwMethod(choice)  " globals: method machine id passwd fname
+" Input:
+"   choice = url   [protocol:]//[userid@]hostname[:port]/[path-to-file]
+" Output:
+"  b:netrw_method= 1: rcp                                             
+"                  2: ftp + <.netrc>                                  
+"	           3: ftp + machine, id, password, and [path]filename 
+"	           4: scp                                             
+"	           5: http (wget)                                     
+"	           6: dav
+"	           7: rsync                                           
+"	           8: fetch                                           
+"	           9: sftp                                            
+"  g:netrw_machine= hostname
+"  b:netrw_fname  = filename
+"  g:netrw_port   = optional port number (for ftp)
+"  g:netrw_choice = copy of input url (choice)
+fun! s:NetrwMethod(choice)
 "   call Dfunc("NetrwMethod(a:choice<".a:choice.">)")
 
+   " record current g:netrw_machine, if any
+   " curmachine used if protocol == ftp and no .netrc
+   if exists("g:netrw_machine")
+    let curmachine= g:netrw_machine
+"    call Decho("curmachine<".curmachine.">")
+   else
+    let curmachine= "N O T A HOST"
+   endif
+
   " initialization
   let b:netrw_method  = 0
   let g:netrw_machine = ""
@@ -1449,7 +1474,7 @@
   " rcphf    : [user@]host:filename		     Use rcp
   " scpurm   : scp://[user@]host[[#:]port]/filename  Use scp
   " httpurm  : http://[user@]host/filename	     Use wget
-  " davurm   : dav[s]://host[:port]/path             Use cadaver
+  " davurm   : dav[s]://host[:port]/path             Use cadaver/curl
   " rsyncurm : rsync://host[:port]/path              Use rsync
   " fetchurm : fetch://[user@]host[:http]/filename   Use fetch (defaults to ftp, override for http)
   " sftpurm  : sftp://[user@]host/filename  Use scp
@@ -1518,9 +1543,14 @@
    let g:netrw_machine= substitute(a:choice,ftpurm,'\3',"")
    let g:netrw_port   = substitute(a:choice,ftpurm,'\4',"")
    let b:netrw_fname  = substitute(a:choice,ftpurm,'\5',"")
+"   call Decho("g:netrw_machine<".g:netrw_machine.">")
    if userid != ""
     let g:netrw_uid= userid
    endif
+   if exists("s:netrw_passwd") && curmachine != g:netrw_machine
+    " if there's a change in hostname, require password re-entry
+    unlet s:netrw_passwd
+   endif
    if exists("g:netrw_uid") && exists("s:netrw_passwd")
     let b:netrw_method = 3
    else
@@ -1592,7 +1622,7 @@
 
   else
    if !exists("g:netrw_quiet")
-    call netrw#ErrorMsg(s:WARNING,"cannot determine method",45)
+    call netrw#ErrorMsg(s:WARNING,"cannot determine method (format: protocol://[user@]hostname[:port]/[path])",45)
    endif
    let b:netrw_method  = -1
   endif
@@ -1626,10 +1656,24 @@
 if has("win95") && exists("g:netrw_win95ftp") && g:netrw_win95ftp
  fun! NetReadFixup(method, line1, line2)
 "   call Dfunc("NetReadFixup(method<".a:method."> line1=".a:line1." line2=".a:line2.")")
+
+   " sanity checks -- attempt to convert inputs to integers
+   let method = a:method + 0
+   let line1  = a:line1 + 0
+   let line2  = a:line2 + 0
+   if type(method) != 0 || type(line1) != 0 || type(line2) != 0 || method < 0 || line1 <= 0 || line2 <= 0
+"    call Dret("NetReadFixup")
+    return
+   endif
+
    if method == 3   " ftp (no <.netrc>)
     let fourblanklines= line2 - 3
-    silent fourblanklines.",".line2."g/^\s*/d"
+    if fourblanklines >= line1
+     exe "silent ".fourblanklines.",".line2."g/^\s*$/d"
+     call histdel("/",-1)
+    endif
    endif
+
 "   call Dret("NetReadFixup")
  endfun
 endif
@@ -1678,7 +1722,7 @@
    nnoremap <buffer> <silent> <cr>	:call netrw#LocalBrowseCheck(<SID>NetrwBrowseChgDir(1,<SID>NetrwGetWord()))<cr>
    nnoremap <buffer> <silent> -		:exe "norm! 0"<bar>call netrw#LocalBrowseCheck(<SID>NetrwBrowseChgDir(1,'../'))<cr>
    nnoremap <buffer> <silent> a		:call <SID>NetrwHide(1)<cr>
-   nnoremap <buffer> <silent> mb	:<c-u>call <SID>NetrwBookmarkDir(0,b:netrw_curdir)<cr>
+   nnoremap <buffer> <silent> mb	:<c-u>call <SID>NetrwBookHistHandler(0,b:netrw_curdir)<cr>
    nnoremap <buffer> <silent> mc	:<c-u>call <SID>NetrwMarkFileCopy(1)<cr>
    nnoremap <buffer> <silent> md	:<c-u>call <SID>NetrwMarkFileDiff(1)<cr>
    nnoremap <buffer> <silent> me	:<c-u>call <SID>NetrwMarkFileEdit(1)<cr>
@@ -1694,25 +1738,28 @@
    nnoremap <buffer> <silent> mu	:<c-u>call <SID>NetrwUnMarkFile(1)<cr>
    nnoremap <buffer> <silent> mx	:<c-u>call <SID>NetrwMarkFileExe(1)<cr>
    nnoremap <buffer> <silent> mz	:<c-u>call <SID>NetrwMarkFileCompress(1)<cr>
-   nnoremap <buffer> <silent> gb	:<c-u>call <SID>NetrwBookmarkDir(1,b:netrw_curdir)<cr>
+   nnoremap <buffer> <silent> gb	:<c-u>call <SID>NetrwBookHistHandler(1,b:netrw_curdir)<cr>
    nnoremap <buffer> <silent> gh	:<c-u>call <SID>NetrwHidden(1)<cr>
+   nnoremap <buffer> <silent> gp	:<c-u>call <SID>NetrwChgPerm(1,b:netrw_curdir)<cr>
    nnoremap <buffer> <silent> c		:exe "keepjumps lcd ".fnameescape(b:netrw_curdir)<cr>
    nnoremap <buffer> <silent> C		:let g:netrw_chgwin= winnr()<cr>
    nnoremap <buffer> <silent> d		:call <SID>NetrwMakeDir("")<cr>
    nnoremap <buffer> <silent> i		:call <SID>NetrwListStyle(1)<cr>
+   nnoremap <buffer> <silent> I		:call <SID>NetrwBannerCtrl(1)<cr>
    nnoremap <buffer> <silent> o		:call <SID>NetrwSplit(3)<cr>
    nnoremap <buffer> <silent> O		:call <SID>NetrwObtain(1)<cr>
    nnoremap <buffer> <silent> p		:call <SID>NetrwPreview(<SID>NetrwBrowseChgDir(1,<SID>NetrwGetWord(),1))<cr>
    nnoremap <buffer> <silent> P		:call <SID>NetrwPrevWinOpen(1)<cr>
-   nnoremap <buffer> <silent> qb	:<c-u>call <SID>NetrwBookmarkDir(2,b:netrw_curdir)<cr>
-   nnoremap <buffer> <silent> mB	:<c-u>call <SID>NetrwBookmarkDir(6,b:netrw_curdir)<cr>
+   nnoremap <buffer> <silent> qb	:<c-u>call <SID>NetrwBookHistHandler(2,b:netrw_curdir)<cr>
+   nnoremap <buffer> <silent> mB	:<c-u>call <SID>NetrwBookHistHandler(6,b:netrw_curdir)<cr>
    nnoremap <buffer> <silent> qf	:<c-u>call <SID>NetrwFileInfo(1,<SID>NetrwGetWord())<cr>
    nnoremap <buffer> <silent> r		:let g:netrw_sort_direction= (g:netrw_sort_direction =~ 'n')? 'r' : 'n'<bar>exe "norm! 0"<bar>call <SID>NetrwRefresh(1,<SID>NetrwBrowseChgDir(1,'./'))<cr>
    nnoremap <buffer> <silent> s		:call <SID>NetrwSortStyle(1)<cr>
    nnoremap <buffer> <silent> S		:call <SID>NetSortSequence(1)<cr>
    nnoremap <buffer> <silent> t		:call <SID>NetrwSplit(4)<cr>
-   nnoremap <buffer> <silent> u		:<c-u>call <SID>NetrwBookmarkDir(4,expand("%"))<cr>
-   nnoremap <buffer> <silent> U		:<c-u>call <SID>NetrwBookmarkDir(5,expand("%"))<cr>
+   nnoremap <buffer> <silent> T		:call <SID>NetrwSplit(4)<bar>norm! gT<cr>
+   nnoremap <buffer> <silent> u		:<c-u>call <SID>NetrwBookHistHandler(4,expand("%"))<cr>
+   nnoremap <buffer> <silent> U		:<c-u>call <SID>NetrwBookHistHandler(5,expand("%"))<cr>
    nnoremap <buffer> <silent> v		:call <SID>NetrwSplit(5)<cr>
    nnoremap <buffer> <silent> x		:call netrw#NetrwBrowseX(<SID>NetrwBrowseChgDir(1,<SID>NetrwGetWord(),0),0)"<cr>
    nnoremap <buffer> <silent> %		:call <SID>NetrwOpenFile(1)<cr>
@@ -1754,7 +1801,7 @@
    nnoremap <buffer> <silent> <c-l>	:call <SID>NetrwRefresh(0,<SID>NetrwBrowseChgDir(0,'./'))<cr>
    nnoremap <buffer> <silent> -		:exe "norm! 0"<bar>call <SID>NetrwBrowse(0,<SID>NetrwBrowseChgDir(0,'../'))<cr>
    nnoremap <buffer> <silent> a		:call <SID>NetrwHide(0)<cr>
-   nnoremap <buffer> <silent> mb	:<c-u>call <SID>NetrwBookmarkDir(0,b:netrw_curdir)<cr>
+   nnoremap <buffer> <silent> mb	:<c-u>call <SID>NetrwBookHistHandler(0,b:netrw_curdir)<cr>
    nnoremap <buffer> <silent> mc	:<c-u>call <SID>NetrwMarkFileCopy(0)<cr>
    nnoremap <buffer> <silent> md	:<c-u>call <SID>NetrwMarkFileDiff(0)<cr>
    nnoremap <buffer> <silent> me	:<c-u>call <SID>NetrwMarkFileEdit(0)<cr>
@@ -1770,23 +1817,26 @@
    nnoremap <buffer> <silent> mu	:<c-u>call <SID>NetrwUnMarkFile(0)<cr>
    nnoremap <buffer> <silent> mx	:<c-u>call <SID>NetrwMarkFileExe(0)<cr>
    nnoremap <buffer> <silent> mz	:<c-u>call <SID>NetrwMarkFileCompress(0)<cr>
-   nnoremap <buffer> <silent> gb	:<c-u>call <SID>NetrwBookmarkDir(1,b:netrw_cur)<cr>
+   nnoremap <buffer> <silent> gb	:<c-u>call <SID>NetrwBookHistHandler(1,b:netrw_cur)<cr>
    nnoremap <buffer> <silent> gh	:<c-u>call <SID>NetrwHidden(0)<cr>
+   nnoremap <buffer> <silent> gp	:<c-u>call <SID>NetrwChgPerm(0,b:netrw_curdir)<cr>
    nnoremap <buffer> <silent> C		:let g:netrw_chgwin= winnr()<cr>
    nnoremap <buffer> <silent> i		:call <SID>NetrwListStyle(0)<cr>
+   nnoremap <buffer> <silent> I		:call <SID>NetrwBannerCtrl(1)<cr>
    nnoremap <buffer> <silent> o		:call <SID>NetrwSplit(0)<cr>
    nnoremap <buffer> <silent> O		:call <SID>NetrwObtain(0)<cr>
    nnoremap <buffer> <silent> p		:call <SID>NetrwPreview(<SID>NetrwBrowseChgDir(1,<SID>NetrwGetWord(),1))<cr>
    nnoremap <buffer> <silent> P		:call <SID>NetrwPrevWinOpen(0)<cr>
-   nnoremap <buffer> <silent> qb	:<c-u>call <SID>NetrwBookmarkDir(2,b:netrw_curdir)<cr>
-   nnoremap <buffer> <silent> mB	:<c-u>call <SID>NetrwBookmarkDir(6,b:netrw_curdir)<cr>
+   nnoremap <buffer> <silent> qb	:<c-u>call <SID>NetrwBookHistHandler(2,b:netrw_curdir)<cr>
+   nnoremap <buffer> <silent> mB	:<c-u>call <SID>NetrwBookHistHandler(6,b:netrw_curdir)<cr>
    nnoremap <buffer> <silent> qf	:<c-u>call <SID>NetrwFileInfo(0,<SID>NetrwGetWord())<cr>
    nnoremap <buffer> <silent> r		:let g:netrw_sort_direction= (g:netrw_sort_direction =~ 'n')? 'r' : 'n'<bar>exe "norm! 0"<bar>call <SID>NetrwBrowse(0,<SID>NetrwBrowseChgDir(0,'./'))<cr>
    nnoremap <buffer> <silent> s		:call <SID>NetrwSortStyle(0)<cr>
    nnoremap <buffer> <silent> S		:call <SID>NetSortSequence(0)<cr>
    nnoremap <buffer> <silent> t		:call <SID>NetrwSplit(1)<cr>
-   nnoremap <buffer> <silent> u		:<c-u>call <SID>NetrwBookmarkDir(4,b:netrw_curdir)<cr>
-   nnoremap <buffer> <silent> U		:<c-u>call <SID>NetrwBookmarkDir(5,b:netrw_curdir)<cr>
+   nnoremap <buffer> <silent> T		:call <SID>NetrwSplit(1)<bar>norm! gT<cr>
+   nnoremap <buffer> <silent> u		:<c-u>call <SID>NetrwBookHistHandler(4,b:netrw_curdir)<cr>
+   nnoremap <buffer> <silent> U		:<c-u>call <SID>NetrwBookHistHandler(5,b:netrw_curdir)<cr>
    nnoremap <buffer> <silent> v		:call <SID>NetrwSplit(2)<cr>
    nnoremap <buffer> <silent> x		:call netrw#NetrwBrowseX(<SID>NetrwBrowseChgDir(0,<SID>NetrwGetWord()),1)<cr>
    nnoremap <buffer> <silent> %		:call <SID>NetrwOpenFile(0)<cr>
@@ -1836,7 +1886,7 @@
 endfun
 
 " ---------------------------------------------------------------------
-"  s:NetrwBookmarkDir: {{{2
+"  s:NetrwBookHistHandler: {{{2
 "    0: (user: <mb>)   bookmark current directory
 "    1: (user: <gb>)   change to the bookmarked directory
 "    2: (user: <qb>)   list bookmarks
@@ -1844,32 +1894,27 @@
 "    4: (user: <u>)    go up   (previous) bookmark
 "    5: (user: <U>)    go down (next)     bookmark
 "    6: (user: <mB>)   delete bookmark
-fun! s:NetrwBookmarkDir(chg,curdir)
-"  call Dfunc("NetrwBookmarkDir(chg=".a:chg." curdir<".a:curdir.">) cnt=".v:count." bookmarkcnt=".g:NETRW_BOOKMARKMAX." histcnt=".g:NETRW_DIRHIST_CNT." bookmax=".g:NETRW_BOOKMARKMAX." histmax=".g:netrw_dirhistmax)
+fun! s:NetrwBookHistHandler(chg,curdir)
+"  call Dfunc("NetrwBookHistHandler(chg=".a:chg." curdir<".a:curdir.">) cnt=".v:count." histcnt=".g:netrw_dirhist_cnt." histmax=".g:netrw_dirhistmax)
 
   if a:chg == 0
    " bookmark the current directory
 "   call Decho("(user: <b>) bookmark the current directory")
-   if v:count > 0
-    " handle bookmark# specified via the count
-    let g:NETRW_BOOKMARKDIR_{v:count}= a:curdir
-    if !exists("g:NETRW_BOOKMARKMAX")
-     let g:NETRW_BOOKMARKMAX= v:count
-    elseif v:count > g:NETRW_BOOKMARKMAX
-     let g:NETRW_BOOKMARKMAX= v:count
-    endif
-   else
-    " handle no count specified
-    let g:NETRW_BOOKMARKMAX                       = g:NETRW_BOOKMARKMAX + 1
-    let g:NETRW_BOOKMARKDIR_{g:NETRW_BOOKMARKMAX} = a:curdir
+   if !exists("g:netrw_bookmarklist")
+    let g:netrw_bookmarklist= []
+   endif
+   if index(g:netrw_bookmarklist,a:curdir) == -1
+    " curdir not currently in g:netrw_bookmarklist, so include it
+    call add(g:netrw_bookmarklist,a:curdir)
+    call sort(g:netrw_bookmarklist)
    endif
    echo "bookmarked the current directory"
 
   elseif a:chg == 1
    " change to the bookmarked directory
-"   call Decho("(user: <B>) change to the bookmarked directory")
-   if exists("g:NETRW_BOOKMARKDIR_{v:count}")
-    exe "e ".fnameescape(g:NETRW_BOOKMARKDIR_{v:count})
+"   call Decho("(user: <".v:count."mb>) change to the bookmarked directory")
+   if exists("g:netrw_bookmarklist[v:count-1]")
+    exe "e ".fnameescape(g:netrw_bookmarklist[v:count-1])
    else
     echomsg "Sorry, bookmark#".v:count." doesn't exist!"
    endif
@@ -1879,29 +1924,27 @@
    let didwork= 0
    " list user's bookmarks
 "   call Decho("(user: <q>) list user's bookmarks")
-   if exists("g:NETRW_BOOKMARKMAX")
-"    call Decho("list bookmarks [0,".g:NETRW_BOOKMARKMAX."]")
-    let cnt= 0
-    while cnt <= g:NETRW_BOOKMARKMAX
-     if exists("g:NETRW_BOOKMARKDIR_{cnt}")
-"      call Decho("Netrw Bookmark#".cnt.": ".g:NETRW_BOOKMARKDIR_{cnt})
-      echo "Netrw Bookmark#".cnt.": ".g:NETRW_BOOKMARKDIR_{cnt}
-      let didwork= 1
-     endif
-     let cnt= cnt + 1
-    endwhile
+   if exists("g:netrw_bookmarklist")
+"    call Decho('list '.len(g:netrw_bookmarklist).' bookmarks')
+    let cnt= 1
+    for bmd in g:netrw_bookmarklist
+"     call Decho("Netrw Bookmark#".cnt.": ".g:netrw_bookmarklist[cnt-1])
+     echo "Netrw Bookmark#".cnt.": ".g:netrw_bookmarklist[cnt-1]
+     let didwork = 1
+     let cnt     = cnt + 1
+    endfor
    endif
 
    " list directory history
-   let cnt     = g:NETRW_DIRHIST_CNT
+   let cnt     = g:netrw_dirhist_cnt
    let first   = 1
    let histcnt = 0
-   while ( first || cnt != g:NETRW_DIRHIST_CNT )
-"    call Decho("first=".first." cnt=".cnt." dirhist_cnt=".g:NETRW_DIRHIST_CNT)
+   while ( first || cnt != g:netrw_dirhist_cnt )
+"    call Decho("first=".first." cnt=".cnt." dirhist_cnt=".g:netrw_dirhist_cnt)
     let histcnt= histcnt + 1
-    if exists("g:NETRW_DIRHIST_{cnt}")
-"     call Decho("Netrw  History#".histcnt.": ".g:NETRW_DIRHIST_{cnt})
-     echo "Netrw  History#".histcnt.": ".g:NETRW_DIRHIST_{cnt}
+    if exists("g:netrw_dirhist_{cnt}")
+"     call Decho("Netrw  History#".histcnt.": ".g:netrw_dirhist_{cnt})
+     echo "Netrw  History#".histcnt.": ".g:netrw_dirhist_{cnt}
      let didwork= 1
     endif
     let first = 0
@@ -1917,22 +1960,21 @@
   elseif a:chg == 3
    " saves most recently visited directories (when they differ)
 "   call Decho("(browsing) record curdir history")
-   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')
-    let g:NETRW_DIRHIST_{g:NETRW_DIRHIST_CNT}= a:curdir
-"    call Decho("save dirhist#".g:NETRW_DIRHIST_CNT."<".g:NETRW_DIRHIST_{g:NETRW_DIRHIST_CNT}.">")
+   if !exists("g:netrw_dirhist_cnt") || !exists("g:netrw_dirhist_{g:netrw_dirhist_cnt}") || 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} = a:curdir
+"    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
 "   call Decho("(user: <u>) chg to prev dir from history")
-   let g:NETRW_DIRHIST_CNT= ( g:NETRW_DIRHIST_CNT - 1 ) % g:netrw_dirhistmax
-   if g:NETRW_DIRHIST_CNT < 0
-    let g:NETRW_DIRHIST_CNT= g:NETRW_DIRHIST_CNT + g:netrw_dirhistmax
+   let g:netrw_dirhist_cnt= ( g:netrw_dirhist_cnt - 1 ) % g:netrw_dirhistmax
+   if g:netrw_dirhist_cnt < 0
+    let g:netrw_dirhist_cnt= g:netrw_dirhist_cnt + g:netrw_dirhistmax
    endif
-   if exists("g:NETRW_DIRHIST_{g:NETRW_DIRHIST_CNT}")
-"    call Decho("changedir u#".g:NETRW_DIRHIST_CNT."<".g:NETRW_DIRHIST_{g:NETRW_DIRHIST_CNT}.">")
+   if exists("g:netrw_dirhist_{g:netrw_dirhist_cnt}")
+"    call Decho("changedir u#".g:netrw_dirhist_cnt."<".g:netrw_dirhist_{g:netrw_dirhist_cnt}.">")
     if exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST && exists("b:netrw_curdir")
      setlocal ma noro
 "     call Decho("setlocal ma noro")
@@ -1940,19 +1982,19 @@
      setlocal nomod
 "     call Decho("setlocal nomod")
     endif
-"    "    call Decho("exe e! ".fnameescape(g:NETRW_DIRHIST_{g:NETRW_DIRHIST_CNT}))
-    exe "e! ".fnameescape(g:NETRW_DIRHIST_{g:NETRW_DIRHIST_CNT})
+"    "    call Decho("exe e! ".fnameescape(g:netrw_dirhist_{g:netrw_dirhist_cnt}))
+    exe "e! ".fnameescape(g:netrw_dirhist_{g:netrw_dirhist_cnt})
    else
-    let g:NETRW_DIRHIST_CNT= ( g:NETRW_DIRHIST_CNT + 1 ) % g:netrw_dirhistmax
+    let g:netrw_dirhist_cnt= ( g:netrw_dirhist_cnt + 1 ) % g:netrw_dirhistmax
     echo "Sorry, no predecessor directory exists yet"
    endif
 
   elseif a:chg == 5
    " U: change to the subsequent directory stored on the history list
 "   call Decho("(user: <U>) chg to next dir from history")
-   let g:NETRW_DIRHIST_CNT= ( g:NETRW_DIRHIST_CNT + 1 ) % g:netrw_dirhistmax
-   if exists("g:NETRW_DIRHIST_{g:NETRW_DIRHIST_CNT}")
-"    call Decho("changedir U#".g:NETRW_DIRHIST_CNT."<".g:NETRW_DIRHIST_{g:NETRW_DIRHIST_CNT}.">")
+   let g:netrw_dirhist_cnt= ( g:netrw_dirhist_cnt + 1 ) % g:netrw_dirhistmax
+   if exists("g:netrw_dirhist_{g:netrw_dirhist_cnt}")
+"    call Decho("changedir U#".g:netrw_dirhist_cnt."<".g:netrw_dirhist_{g:netrw_dirhist_cnt}.">")
     if exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST && exists("b:netrw_curdir")
      setlocal ma noro
 "     call Decho("setlocal ma noro")
@@ -1961,57 +2003,108 @@
      setlocal nomod
 "     call Decho("setlocal nomod")
     endif
-"    call Decho("exe e! ".fnameescape(g:NETRW_DIRHIST_{g:NETRW_DIRHIST_CNT}))
-    exe "e! ".fnameescape(g:NETRW_DIRHIST_{g:NETRW_DIRHIST_CNT})
+"    call Decho("exe e! ".fnameescape(g:netrw_dirhist_{g:netrw_dirhist_cnt}))
+    exe "e! ".fnameescape(g:netrw_dirhist_{g:netrw_dirhist_cnt})
    else
-    let g:NETRW_DIRHIST_CNT= ( g:NETRW_DIRHIST_CNT - 1 ) % g:netrw_dirhistmax
-    if g:NETRW_DIRHIST_CNT < 0
-     let g:NETRW_DIRHIST_CNT= g:NETRW_DIRHIST_CNT + g:netrw_dirhistmax
+    let g:netrw_dirhist_cnt= ( g:netrw_dirhist_cnt - 1 ) % g:netrw_dirhistmax
+    if g:netrw_dirhist_cnt < 0
+     let g:netrw_dirhist_cnt= g:netrw_dirhist_cnt + g:netrw_dirhistmax
     endif
     echo "Sorry, no successor directory exists yet"
    endif
 
   elseif a:chg == 6
-   if v:count > 0 && v:count == g:NETRW_BOOKMARKMAX
-    " delete the v:count'th bookmark
-"    call Decho("delete bookmark#".v:count."<".g:NETRW_BOOKMARKDIR_{g:NETRW_BOOKMARKMAX}.">")
-    unlet g:NETRW_BOOKMARKDIR_{g:NETRW_BOOKMARKMAX}
-    let g:NETRW_BOOKMARKMAX= g:NETRW_BOOKMARKMAX - 1
-
-   elseif v:count > 0
-"    call Decho("delete by shifting bookmark#".v:count."<".g:NETRW_BOOKMARKDIR_{v:count}.">")
-    let cnt= v:count
-    while cnt < g:NETRW_BOOKMARKMAX
-     let g:NETRW_BOOKMARKDIR_{cnt} = g:NETRW_BOOKMARKDIR_{(cnt+1)}
-     let cnt                       = cnt + 1
-    endwhile
-    unlet g:NETRW_BOOKMARKDIR_{g:NETRW_BOOKMARKMAX}
-    let g:NETRW_BOOKMARKMAX= g:NETRW_BOOKMARKMAX - 1
-
-   elseif exists("b:netrw_curdir")
-    " look for current directory amongst the bookmarks and remove that bookmark
-"    call Decho("search for bookmark<".b:netrw_curdir.">")
-    let cnt= 1
-    while cnt <= g:NETRW_BOOKMARKMAX
-"     call Decho("checking: g:NETRW_BOOKMARKDIR_".cnt."<".g:NETRW_BOOKMARKDIR_{cnt}.">")
-     if g:NETRW_BOOKMARKDIR_{cnt} == b:netrw_curdir
-      if cnt < g:NETRW_BOOKMARKMAX
-"       call Decho("delete bookmark#".cnt."<".b:netrw_curdir.">")
-       while cnt < g:NETRW_BOOKMARMAX
-        let g:NETRW_BOOKMARKDIR_{cnt} = g:NETRW_BOOKMARKDIR_{(cnt+1)}
-        let cnt                       = cnt + 1
-       endwhile
-      endif
-      unlet g:NETRW_BOOKMARKDIR_{g:NETRW_BOOKMARKMAX}
-      let g:NETRW_BOOKMARKMAX= g:NETRW_BOOKMARKMAX - 1
-     endif
-     let cnt= cnt + 1
-    endwhile
+   " delete the v:count'th bookmark
+"   call Decho("delete bookmark#".v:count."<".g:netrw_bookmarklist[v:count-1].">")
+   let savefile= s:NetrwHome()."/.netrwbook"
+   if filereadable(savefile)
+    call s:NetrwBookHistSave() " done here to merge bookmarks first
+    call delete(savefile)
    endif
-
+   call remove(g:netrw_bookmarklist,v:count-1)
   endif
   call s:NetrwBookmarkMenu()
-"  call Dret("NetrwBookmarkDir")
+"  call Dret("NetrwBookHistHandler")
+endfun
+
+" ---------------------------------------------------------------------
+" s:NetrwBookHistRead: this function reads bookmarks and history {{{2
+"                      Sister function: s:NetrwBookHistSave()
+fun! s:NetrwBookHistRead()
+"  call Dfunc("s:NetrwBookHistRead()")
+  if !exists("s:netrw_initbookhist")
+   let home    = s:NetrwHome()
+   let savefile= home."/.netrwbook"
+   if filereadable(savefile)
+"    call Decho("sourcing .netrwbook")
+    exe "so ".savefile
+   endif
+   let savefile= home."/.netrwhist"
+   if filereadable(savefile)
+"    call Decho("sourcing .netrwhist")
+    exe "so ".savefile
+   endif
+   let s:netrw_initbookhist= 1
+   au VimLeave * call s:NetrwBookHistSave()
+  endif
+"  call Dret("s:NetrwBookHistRead")
+endfun
+
+" ---------------------------------------------------------------------
+" s:NetrwBookHistSave: this function saves bookmarks and history {{{2
+"                      Sister function: s:NetrwBookHistRead()
+"                      I used to do this via viminfo but that appears to
+"                      be unreliable for long-term storage
+"                      COMBAK: does $HOME work under windows???
+fun! s:NetrwBookHistSave()
+"  call Dfunc("s:NetrwBookHistSave() dirhistmax=".g:netrw_dirhistmax)
+  let savefile= s:NetrwHome()."/.netrwhist"
+  1split
+  call s:NetrwEnew()
+  setlocal cino= com= cpo-=aA fo=nroql2 tw=0 report=10000 noswf
+  setlocal nocin noai noci magic nospell nohid wig= noaw
+  setlocal ma noro write
+  if exists("&acd") | setlocal noacd | endif
+  silent %d
+
+  " save .netrwhist -- no attempt to merge
+  silent! file .netrwhist
+  call setline(1,"let g:netrw_dirhistmax  =".g:netrw_dirhistmax)
+  call setline(2,"let g:netrw_dirhist_cnt =".g:netrw_dirhist_cnt)
+  let lastline = line("$")
+  let cnt      = 1
+  while cnt <= g:netrw_dirhist_cnt
+   call setline((cnt+lastline),'let g:netrw_dirhist_'.cnt."='".g:netrw_dirhist_{cnt}."'")
+   let cnt= cnt + 1
+  endwhile
+  exe "silent! w! ".savefile
+
+  silent %d
+  if exists("g:netrw_bookmarklist") && g:netrw_bookmarklist != []
+   " merge and write .netrwbook
+   let savefile= s:NetrwHome()."/.netrwbook"
+
+   if filereadable(savefile)
+    let booklist= deepcopy(g:netrw_bookmarklist)
+    exe "silent so ".savefile
+    for bdm in booklist
+     if index(g:netrw_bookmarklist,bdm) == -1
+      call add(g:netrw_bookmarklist,bdm)
+     endif
+    endfor
+    call sort(g:netrw_bookmarklist)
+    exe "silent! w! ".savefile
+   endif
+
+   " construct and save .netrwbook
+   call setline(1,"let g:netrw_bookmarklist= ".string(g:netrw_bookmarklist))
+   exe "silent! w! ".savefile
+  endif
+  let bgone= bufnr("%")
+  q!
+  exe bgone."bwipe!"
+
+"  call Dret("s:NetrwBookHistSave")
 endfun
 
 " ---------------------------------------------------------------------
@@ -2024,6 +2117,18 @@
 "  call Dfunc("s:NetrwBrowse(islocal=".a:islocal." dirname<".a:dirname.">) liststyle=".w:netrw_liststyle." ".g:loaded_netrw." buf#".bufnr("%")."<".bufname("%").">")
 "  call Decho("tab#".tabpagenr()." win#".winnr())
 "  call Dredir("ls!")
+  if !exists("s:netrw_initbookhist")
+   call s:NetrwBookHistRead()
+  endif
+"  call FOTEST(7)
+
+  " simplify the dirname (especially for ".."s in dirnames)
+  if a:dirname !~ '^\a\+://'
+   let dirname= simplify(a:dirname)
+  else
+   let dirname= a:dirname
+  endif
+"  call FOTEST(8)
 
   if exists("s:netrw_skipbrowse")
    unlet s:netrw_skipbrowse
@@ -2043,37 +2148,40 @@
   endif
 
   call s:NetrwOptionSave("w:")
-  call s:NetrwSafeOptions()
+"  call FOTEST(9)
 
   " re-instate any marked files
   if exists("s:netrwmarkfilelist_{bufnr('%')}")
 "   call Decho("clearing marked files")
    exe "2match netrwMarkFile /".s:netrwmarkfilemtch_{bufnr("%")}."/"
   endif
+"  call FOTEST(10)
 
   if a:islocal && exists("w:netrw_acdkeep") && w:netrw_acdkeep
 "   call Decho("handle w:netrw_acdkeep:")
-"   call Decho("keepjumps lcd ".fnameescape(a:dirname)." (due to w:netrw_acdkeep=".w:netrw_acdkeep." - acd=".&acd.")")
-   exe 'keepjumps lcd '.fnameescape(a:dirname)
+"   call Decho("keepjumps lcd ".fnameescape(dirname)." (due to w:netrw_acdkeep=".w:netrw_acdkeep." - acd=".&acd.")")
+   exe 'keepjumps lcd '.fnameescape(dirname)
+   call s:NetrwSafeOptions()
 "   call Decho("getcwd<".getcwd().">")
 
-  elseif !a:islocal && a:dirname !~ '[\/]$' && a:dirname !~ '^"'
+  elseif !a:islocal && dirname !~ '[\/]$' && dirname !~ '^"'
    " looks like a regular file, attempt transfer
-"   call Decho("attempt transfer as regular file<".a:dirname.">")
+"   call Decho("attempt transfer as regular file<".dirname.">")
 
    " remove any filetype indicator from end of dirname, except for the {{{3
    " "this is a directory" indicator (/).
    " There shouldn't be one of those here, anyway.
-   let path= substitute(a:dirname,'[*=@|]\r\=$','','e')
+   let path= substitute(dirname,'[*=@|]\r\=$','','e')
 "   call Decho("new path<".path.">")
-   call s:RemotePathAnalysis(a:dirname)
+   call s:RemotePathAnalysis(dirname)
 
    " remote-read the requested file into current buffer {{{3
    mark '
-   call s:NetrwEnew(a:dirname)
+   call s:NetrwEnew(dirname)
+   call s:NetrwSafeOptions()
    setlocal ma noro
 "   call Decho("setlocal ma noro")
-   let b:netrw_curdir= a:dirname
+   let b:netrw_curdir= dirname
 "   call Decho("exe silent! keepalt file ".fnameescape(s:method."://".s:user.s:machine."/".s:path)." (bt=".&bt.")")
    exe "silent! keepalt file ".fnameescape(s:method."://".s:user.s:machine."/".s:path)
    exe "silent keepalt doau BufReadPre ".fnameescape(s:fname)
@@ -2092,17 +2200,19 @@
 "   call Dret("s:NetrwBrowse : file<".s:fname.">")
    return
   endif
+"  call FOTEST(11)
 
   " use buffer-oriented WinVars if buffer ones exist but window ones don't {{{3
   call s:UseBufWinVars()
 
   " set up some variables {{{3
   let b:netrw_browser_active = 1
-  let dirname                = a:dirname
+  let dirname                = dirname
   let s:last_sort_by         = g:netrw_sort_by
 
   " set up menu {{{3
   call s:NetrwMenu(1)
+"  call FOTEST(12)
 
   " set up buffer {{{3
   let reusing= s:NetrwGetBuffer(a:islocal,dirname)
@@ -2122,6 +2232,7 @@
 "   call Dret("s:NetrwBrowse : re-using buffer")
    return
   endif
+""  call FOTEST(13) " PROBLEM WITH LISTING
 
   " set b:netrw_curdir to the new directory name {{{3
 "  call Decho("set b:netrw_curdir to the new directory name:")
@@ -2143,6 +2254,7 @@
    let b:netrw_curdir= b:netrw_curdir.'/'
   endif
 "  call Decho("b:netrw_curdir<".b:netrw_curdir.">")
+""  call FOTEST(14) " PROBLEM WITH LISTING
 
   " ------------
   " (local only) {{{3
@@ -2183,11 +2295,11 @@
   else
 "   call Decho("remote only:")
 
-   " analyze a:dirname and g:netrw_list_cmd {{{4
-"   call Decho("b:netrw_curdir<".(exists("b:netrw_curdir")? b:netrw_curdir : "doesn't exist")."> a:dirname<".a:dirname.">")
-   if a:dirname =~ "^NetrwTreeListing\>"
+   " analyze dirname and g:netrw_list_cmd {{{4
+"   call Decho("b:netrw_curdir<".(exists("b:netrw_curdir")? b:netrw_curdir : "doesn't exist")."> dirname<".dirname.">")
+   if dirname =~ "^NetrwTreeListing\>"
     let dirname= b:netrw_curdir
-"    call Decho("(dirname was ".a:dirname.") dirname<".dirname.">")
+"    call Decho("(dirname was ".dirname.") dirname<".dirname.">")
    elseif exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST && exists("b:netrw_curdir")
     let dirname= substitute(b:netrw_curdir,'\\','/','g')
     if dirname !~ '/$'
@@ -2196,7 +2308,7 @@
     let b:netrw_curdir = dirname
 "    call Decho("(liststyle is TREELIST) dirname<".dirname.">")
    else
-    let dirname = substitute(a:dirname,'\\','/','g')
+    let dirname = substitute(dirname,'\\','/','g')
 "    call Decho("(normal) dirname<".dirname.">")
    endif
 
@@ -2214,12 +2326,23 @@
    let b:netrw_curdir= dirname
 "   call Decho("b:netrw_curdir<".b:netrw_curdir."> (remote)")
   endif  " (additional remote handling)
+""  call FOTEST(15) " PROBLEM WITH LISTING
 
   " -----------------------
   " Directory Listing: {{{3
   " -----------------------
   call s:BrowserMaps(a:islocal)
+""  call FOTEST(16) " PROBLEM WITH LISTING
   call s:PerformListing(a:islocal)
+"  call FOTEST(17)
+
+  " The s:LocalBrowseShellCmdRefresh() function is called by an autocmd
+  " installed by s:LocalFastBrowser() when g:netrw_fastbrowse <= 1 (ie. slow, medium speed).
+  " However, s:NetrwBrowse() causes the ShellCmdPost event itself to fire once; setting
+  " the variable below avoids that second refresh of the screen.  The s:LocalBrowseShellCmdRefresh()
+  " function gets called due to that autocmd; it notices that the following variable is set
+  " and skips the refresh and sets s:locbrowseshellcmd to zero. Oct 13, 2008
+  let s:locbrowseshellcmd= 1
 
 "  call Decho("ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap)
 "  call Dret("s:NetrwBrowse : did PerformListing")
@@ -2274,13 +2397,14 @@
 "  call Decho("--re-use a buffer if possible--")
   if exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST
    " find NetrwTreeList buffer if there is one
+"   call Decho("find NetrwTreeList buffer if there is one")
    if exists("w:netrw_treebufnr") && w:netrw_treebufnr > 0
 "    call Decho("  re-use w:netrw_treebufnr=".w:netrw_treebufnr)
     let eikeep= &ei
     set ei=all
     exe "b ".w:netrw_treebufnr
     let &ei= eikeep
-"    call Dret("s:NetrwGetBuffer : bufnum#".bufnum."<NetrwTreeListing>")
+"    call Dret("s:NetrwGetBuffer : bufnum#".w:netrw_treebufnr."<NetrwTreeListing>")
     return
    endif
    let bufnum= -1
@@ -2297,7 +2421,7 @@
 "   call Decho("  bufnr(dirname<".escape(dirname,'\').">)=".bufnum)
 
    if bufnum < 0 && dirname !~ '/$'
-    " trying appending a trailing /
+    " try appending a trailing /
 "    call Decho("  try appending a trailing / to dirname<".dirname.">")
     let bufnum= bufnr(escape(dirname.'/','\'))
     if bufnum > 0
@@ -2306,7 +2430,7 @@
    endif
 
    if bufnum < 0 && dirname =~ '/$'
-    " trying removing a trailing /
+    " try removing a trailing /
 "    call Decho("  try removing a trailing / from dirname<".dirname.">")
     let bufnum= bufnr(escape(substitute(dirname,'/$','',''),'\'))
     if bufnum > 0
@@ -2318,17 +2442,26 @@
    " note: !~ was used just below, but that means using ../ to go back would match (ie. abc/def/  and abc/ matches)
    if bufnum > 0 && bufname(bufnum) != dirname && bufname(bufnum) != '.'
     " handle approximate matches
-"    call Decho("  handling approx match: bufnum#%d<".bufname(bufnum)."> approx=dirname<".dirname.">")
+"    call Decho("  handling approx match: bufnum#".bufnum."<".bufname(bufnum)."> approx-dirname<".dirname.">")
     let ibuf    = 1
     let buflast = bufnr("$")
 "    call Decho("  findbuf2: buflast=".buflast)
     while ibuf <= buflast
      let bname= substitute(bufname(ibuf),'\\','/','g')
      let bname= substitute(bname,'.\zs/$','','')
-"     call Decho("  findbuf3: dirname<".dirname."> bufname(".ibuf.")<".bname.">")
-     if bname != '' && dirname =~ '/'.bname.'/\=$' | break | endif
-     if bname   =~ '^'.dirname.'/\=$' | break | endif
-     if dirname =~ '^'.bname.'/$'     | break | endif
+"     call Decho("  findbuf3: while [ibuf=",ibuf."]<=[buflast=".buflast."]: dirname<".dirname."> bufname(".ibuf.")<".bname.">")
+     if bname   != '' && dirname =~ '/'.bname.'/\=$' && dirname !~ '^/'
+"      call Decho("  findbuf3: passes test 1 : dirname<".dirname.'> =~ /'.bname.'/\=$ && dirname !~ ^/')
+      break
+     endif
+     if bname   =~ '^'.dirname.'/\=$'
+"      call Decho('  findbuf3: passes test 2 : bname<'.bname.'>=~^'.dirname.'/\=$')
+      break
+     endif
+     if dirname =~ '^'.bname.'/$'
+"      call Decho('  findbuf3: passes test 3 : dirname<'.dirname.'>=~^'.bname.'/$')
+      break
+     endif
      let ibuf= ibuf + 1
     endwhile
     if ibuf > buflast
@@ -2510,6 +2643,7 @@
    if !exists("b:netrw_cpf")
     let b:netrw_cpf= 0
     exe 'silent keepjumps '.w:netrw_bannercnt.',$g/^./if virtcol("$") > b:netrw_cpf|let b:netrw_cpf= virtcol("$")|endif'
+    call histdel("/",-1)
 "   call Decho("computed cpf=".b:netrw_cpf)
    endif
 
@@ -2621,6 +2755,22 @@
   let svpos= netrw#NetrwSavePosn()
   call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./'))
   call netrw#NetrwRestorePosn(svpos)
+  if w:netrw_liststyle != s:WIDELIST
+   if g:netrw_cursorline == 2
+    setlocal cursorline
+    let &cursorcolumn= s:netrw_usercuc
+   elseif g:netrw_cursorline
+    setlocal cursorline
+"    call Decho("setlocal cursorline")
+   endif
+  else
+   if g:netrw_cursorline == 2
+    setlocal cursorline cursorcolumn
+"    call Decho("setlocal cursorline cursorcolumn")
+   elseif g:netrw_cursorline
+    let &cursorline= s:netrw_usercul
+   endif
+  endif
 
   " keep cursor on the filename
   silent keepjumps $
@@ -2634,6 +2784,29 @@
 endfun
 
 " ---------------------------------------------------------------------
+" s:NetrwBannerCtrl: toggles the display of the banner {{{2
+fun! s:NetrwBannerCtrl(islocal)
+"  call Dfunc("s:NetrwBannerCtrl(islocal=".a:islocal.") g:netrw_banner=".g:netrw_banner)
+
+  " toggle the banner (enable/suppress)
+  let g:netrw_banner= !g:netrw_banner
+
+  " refresh the listing
+  let svpos= netrw#NetrwSavePosn()
+  call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./'))
+
+  " keep cursor on the filename
+  let fname= s:NetrwGetWord()
+  silent keepjumps $
+  let result= search('\%(^\%(|\+\s\)\=\|\s\{2,}\)\zs'.escape(fname,'.\[]*$^').'\%(\s\{2,}\|$\)','bc')
+"  call Decho("search result=".result." w:netrw_bannercnt=".(exists("w:netrw_bannercnt")? w:netrw_bannercnt : 'N/A'))
+  if result <= 0 && exists("w:netrw_bannercnt")
+   exe "keepjumps ".w:netrw_bannercnt
+  endif
+"  call Dret("s:NetrwBannerCtrl : g:netrw_banner=".g:netrw_banner)
+endfun
+
+" ---------------------------------------------------------------------
 " s:NetrwBookmarkMenu: Uses menu priorities {{{2
 "                      .2.[cnt] for bookmarks, and
 "                      .3.[cnt] for history
@@ -2642,37 +2815,47 @@
   if !exists("s:netrw_menucnt")
    return
   endif
-"  call Dfunc("NetrwBookmarkMenu() bookmarkcnt=".g:NETRW_BOOKMARKMAX." histcnt=".g:NETRW_DIRHIST_CNT." menucnt=".s:netrw_menucnt)
+"  call Dfunc("NetrwBookmarkMenu()  histcnt=".g:netrw_dirhist_cnt." menucnt=".s:netrw_menucnt)
 
   " the following test assures that gvim is running, has menus available, and has menus enabled.
   if has("gui") && has("menu") && has("gui_running") && &go =~ 'm' && g:netrw_menu
    if exists("g:NetrwTopLvlMenu")
 "    call Decho("removing ".g:NetrwTopLvlMenu."Bookmarks menu item(s)")
     exe 'silent! unmenu '.g:NetrwTopLvlMenu.'Bookmarks'
+    exe 'silent! unmenu '.g:NetrwTopLvlMenu.'Bookmarks\ and\ History.Bookmark\ Delete'
+   endif
+   if !exists("s:netrw_initbookhist")
+    call s:NetrwBookHistRead()
    endif
 
    " show bookmarked places
-   let cnt       = 1
-   while cnt <= g:NETRW_BOOKMARKMAX
-    if exists("g:NETRW_BOOKMARKDIR_{cnt}")
-     let bmdir= escape(g:NETRW_BOOKMARKDIR_{cnt},'. ')
-"     call Decho('silent! menu '.g:NetrwMenuPriority.".2.".cnt." ".g:NetrwTopLvlMenu.'Bookmark.'.bmdir.'	:e '.bmdir)
-     exe 'silent! menu '.g:NetrwMenuPriority.".2.".cnt." ".g:NetrwTopLvlMenu.'Bookmarks.'.bmdir.'	:e '.bmdir."\<cr>"
-    endif
-    let cnt= cnt + 1
-   endwhile
+   if exists("g:netrw_bookmarklist") && g:netrw_bookmarklist != []
+    let cnt= 1
+    for bmd in g:netrw_bookmarklist
+"     call Decho('silent! menu '.g:NetrwMenuPriority.".2.".cnt." ".g:NetrwTopLvlMenu.'Bookmark.'.bmd.'	:e '.bmd)
+     let bmd= escape(bmd,'. ')
+
+     " show bookmarks for goto menu
+     exe 'silent! menu '.g:NetrwMenuPriority.".2.".cnt." ".g:NetrwTopLvlMenu.'Bookmarks.'.bmd.'	:e '.bmd."\<cr>"
+
+     " show bookmarks for deletion menu
+     exe 'silent! menu '.g:NetrwMenuPriority.".8.2.".cnt." ".g:NetrwTopLvlMenu.'Bookmarks\ and\ History.Bookmark\ Delete.'.bmd.'	'.cnt."mB"
+     let cnt= cnt + 1
+    endfor
+
+   endif
 
    " show directory browsing history
-   let cnt     = g:NETRW_DIRHIST_CNT
+   let cnt     = g:netrw_dirhist_cnt
    let first   = 1
    let histcnt = 0
-   while ( first || cnt != g:NETRW_DIRHIST_CNT )
+   while ( first || cnt != g:netrw_dirhist_cnt )
     let histcnt  = histcnt + 1
-    let priority = g:NETRW_DIRHIST_CNT + histcnt
-    if exists("g:NETRW_DIRHIST_{cnt}")
-     let bmdir= escape(g:NETRW_DIRHIST_{cnt},'/&? ')
-"     call Decho('silent! menu '.g:NetrwMenuPriority.".3.".priority." ".g:NetrwTopLvlMenu.'History.'.bmdir.'	:e '.bmdir)
-     exe 'silent! menu '.g:NetrwMenuPriority.".3.".priority." ".g:NetrwTopLvlMenu.'History.'.bmdir.'	:e '.bmdir."\<cr>"
+    let priority = g:netrw_dirhist_cnt + histcnt
+    if exists("g:netrw_dirhist_{cnt}")
+     let histdir= escape(g:netrw_dirhist_{cnt},'./&? ')
+"     call Decho('silent! menu '.g:NetrwMenuPriority.".3.".priority." ".g:NetrwTopLvlMenu.'History.'.histdir.'	:e '.histdir)
+     exe 'silent! menu '.g:NetrwMenuPriority.".3.".priority." ".g:NetrwTopLvlMenu.'History.'.histdir.'	:e '.histdir."\<cr>"
     endif
     let first = 0
     let cnt   = ( cnt - 1 ) % g:netrw_dirhistmax
@@ -2680,6 +2863,7 @@
      let cnt= cnt + g:netrw_dirhistmax
     endif
    endwhile
+
   endif
 "  call Dret("NetrwBookmarkMenu")
 endfun
@@ -2702,6 +2886,19 @@
    return
   endif
 
+  " check if the status bar was clicked on instead of a file/directory name
+  call feedkeys("\<LeftMouse>")
+  let c= getchar()
+  let mouse_lnum = v:mouse_lnum
+  let wlastline  = line('w$')
+  let lastline   = line('$')
+"  call Decho("v:mouse_lnum=".mouse_lnum." line(w$)=".wlastline." line($)=".lastline)
+  if mouse_lnum == wlastline + 1
+"   call Decho("appears to be a status bar leftmouse click")
+   " appears to be a status bar leftmouse click
+   return
+  endif
+
   call s:NetrwOptionSave("s:")
   call s:NetrwSafeOptions()
   let nbcd_curpos                = netrw#NetrwSavePosn()
@@ -2737,6 +2934,7 @@
     else
      let dirname= s:NetrwTreeDir()."/".newdir
     endif
+"    call Decho("dirname<".dirname.">")
 "    call Decho("tree listing")
    elseif newdir =~ '^\(/\|\a:\)'
     let dirname= newdir
@@ -2751,10 +2949,14 @@
     if !exists("s:didsplit")
      if     g:netrw_browse_split == 1
       new
-      wincmd _
+      if !&ea
+       wincmd _
+      endif
      elseif g:netrw_browse_split == 2
       rightb vert new
-      wincmd |
+      if !&ea
+       wincmd |
+      endif
      elseif g:netrw_browse_split == 3
       tabnew
      elseif g:netrw_browse_split == 4
@@ -2781,6 +2983,22 @@
 "     call Decho("remote file: NetrwBrowse will edit it")
     endif
     let dolockout= 1
+
+    " handle g:Netrw_funcref -- call external-to-netrw functions
+    "   This code will handle g:Netrw_funcref as an individual function reference
+    "   or as a list of function references.  It will ignore anything that's not
+    "   a function reference.  See  :help Funcref  for information about function references.
+    if exists("g:Netrw_funcref")
+     if type(g:Netrw_funcref) == 2
+      call g:Netrw_funcref()
+     elseif type(g:Netrw_funcref) == 3
+      for Fncref in g:Netrw_funcref
+       if type(FncRef) == 2
+        call FncRef()
+       endif
+      endfor
+     endif
+    endif
    endif
 
   elseif newdir =~ '^/'
@@ -2887,15 +3105,16 @@
     " close tree listing for selected subdirectory
 "    call Decho("closing selected subdirectory<".dirname.">")
     call remove(w:netrw_treedict,treedir)
-"    call Decho("removed     entry<".dirname."> from treedict")
+"    call Decho("removed     entry<".treedir."> from treedict")
 "    call Decho("yielding treedict<".string(w:netrw_treedict).">")
-    let dirname= w:netrw_treetop
+    let dirname           = w:netrw_treetop
    else
     " go down one directory
     let dirname= substitute(treedir,'/*$','/','')
 "    call Decho("go down one dir: treedir<".treedir.">")
    endif
    call s:SetRexDir(a:islocal,dirname)
+   let s:treeforceredraw = 1
 
   else
    " go down one directory
@@ -2916,17 +3135,40 @@
 endfun
 
 " ---------------------------------------------------------------------
-" s:NetrwBrowseX:  allows users to write custom functions to operate on {{{2
-"              files given their extension.  Passes 0=local, 1=remote
+" s:NetrwBrowseX:  (implements "x") executes a special "viewer" script or program for the {{{2
+"              given filename; typically this means given their extension.
+"              0=local, 1=remote
 fun! netrw#NetrwBrowseX(fname,remote)
 "  call Dfunc("NetrwBrowseX(fname<".a:fname."> remote=".a:remote.")")
 
+  " special core dump handler
+  if a:fname =~ '/core\(\.\d\+\)\=$'
+   if exists("g:Netrw_corehandler")
+    if type(g:Netrw_corehandler) == 2
+     " g:Netrw_corehandler is a function reference (see :help Funcref)
+"     call Decho("g:Netrw_corehandler is a funcref")
+     call g:Netrw_corehandler(a:fname)
+    elseif type(g:netrw_corehandler) == 3)
+     " g:Netrw_corehandler is a List of function references (see :help Funcref)
+"     call Decho("g:Netrw_corehandler is a List")
+     for Fncref in g:Netrw_corehandler
+      if type(FncRef) == 2
+       call FncRef(a:fname)
+      endif
+     endfor
+    endif
+"    call Dret("NetrwBrowseX : coredump handler invoked")
+    return
+   endif
+  endif
+
   " set up the filename
   " (lower case the extension, make a local copy of a remote file)
   let exten= substitute(a:fname,'.*\.\(.\{-}\)','\1','e')
   if has("win32") || has("win95") || has("win64") || has("win16")
    let exten= substitute(exten,'^.*$','\L&\E','')
   endif
+"  call Decho("exten<".exten.">")
 
   " seems kde systems often have gnome-open due to dependencies, even though
   " gnome-open's subsidiary display tools are largely absent.  Kde systems
@@ -2945,16 +3187,25 @@
 
   if a:remote == 1
    " create a local copy
-   let fname= fnamemodify(tempname(),":r").".".exten
-"   call Decho("a:remote=".a:remote.": create a local copy of <".fname."> as <".fname.">")
-   exe "silent keepjumps bot 1new ".fnameescape(fname)
+"   call Decho("a:remote=".a:remote.": create a local copy of <".a:fname.">")
    setlocal bh=delete
-"   call Decho("read <".fnameescape(fname).">, now writing: exe w! ".fnameescape(fname))
-   exe "silent! w! ".fnameescape(fname)
-   q
+   call netrw#NetRead(3,a:fname)
+   " attempt to rename tempfile
+   let basename= substitute(a:fname,'^\(.*\)/\(.*\)\.\([^.]*\)$','\2','')
+   let newname= substitute(s:netrw_tmpfile,'^\(.*\)/\(.*\)\.\([^.]*\)$','\1/'.basename.'.\3','')
+"   call Decho("basename<".basename.">")
+"   call Decho("newname <".newname.">")
+   if rename(s:netrw_tmpfile,newname) == 0
+    " renaming succeeded
+    let fname= newname
+   else
+    " renaming failed
+    let fname= s:netrw_tmpfile
+   endif
   else
    let fname= a:fname
   endif
+"  call Decho("fname<".fname.">")
 "  call Decho("exten<".exten."> "."netrwFileHandlers#NFH_".exten."():exists=".exists("*netrwFileHandlers#NFH_".exten))
 
   " set up redirection
@@ -2973,6 +3224,7 @@
 
   " extract any viewing options.  Assumes that they're set apart by quotes.
   if exists("g:netrw_browsex_viewer")
+"   call Decho("g:netrw_browsex_viewer<".g:netrw_browsex_viewer.">")
    if g:netrw_browsex_viewer =~ '\s'
     let viewer  = substitute(g:netrw_browsex_viewer,'\s.*$','','')
     let viewopt = substitute(g:netrw_browsex_viewer,'^\S\+\s*','','')." "
@@ -3004,8 +3256,15 @@
    let ret= v:shell_error
 
   elseif has("win32") || has("win64")
-"   call Decho('exe silent !start rundll32 url.dll,FileProtocolHandler '.shellescape(fname,1))
-   exe 'silent !start rundll32 url.dll,FileProtocolHandler '.shellescape(fname,1)
+   if executable("start")
+"    call Decho('exe silent !start rundll32 url.dll,FileProtocolHandler '.shellescape(fname,1))
+    exe 'silent !start rundll32 url.dll,FileProtocolHandler '.shellescape(fname,1)
+   elseif executable("rundll32")
+"    call Decho('exe silent !rundll32 url.dll,FileProtocolHandler '.shellescape(fname,1))
+    exe 'silent !rundll32 url.dll,FileProtocolHandler '.shellescape(fname,1)
+   else
+    call netrw#ErrorMsg(s:WARNING,"rundll32 not on path",74)
+   endif
    call inputsave()|call input("Press <cr> to continue")|call inputrestore()
    let ret= v:shell_error
 
@@ -3060,19 +3319,72 @@
 endfun
 
 " ---------------------------------------------------------------------
+" s:NetrwChgPerm: (implements "gp") change file permission {{{2
+fun! s:NetrwChgPerm(islocal,curdir)
+"  call Dfunc("s:NetrwChgPerm(islocal=".a:islocal." curdir<".a:curdir.">)")
+  call inputsave()
+  let newperm= input("Enter new permission: ")
+  call inputrestore()
+  let chgperm= substitute(g:netrw_chgperm,'\<FILENAME\>',shellescape(expand("<cfile>")),'')
+  let chgperm= substitute(chgperm,'\<PERM\>',shellescape(newperm),'')
+"  call Decho("chgperm<".chgperm.">")
+  call system(chgperm)
+  if v:shell_error != 0
+   call netrw#ErrorMsg(1,"changing permission on file<".expand("<cfile>")."> seems to have failed",75)
+  endif
+  if a:islocal
+   call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./'))
+  endif
+"  call Dret("s:NetrwChgPerm")
+endfun
+
+" ---------------------------------------------------------------------
+" s:NetrwClearExplore: clear explore variables (if any) {{{2
+fun! s:NetrwClearExplore()
+"  call Dfunc("s:NetrwClearExplore()")
+  2match none
+  if exists("s:explore_match")        |unlet s:explore_match        |endif
+  if exists("s:explore_indx")         |unlet s:explore_indx         |endif
+  if exists("s:netrw_explore_prvdir") |unlet s:netrw_explore_prvdir |endif
+  if exists("s:dirstarstar")          |unlet s:dirstarstar          |endif
+  if exists("s:explore_prvdir")       |unlet s:explore_prvdir       |endif
+  if exists("w:netrw_explore_indx")   |unlet w:netrw_explore_indx   |endif
+  if exists("w:netrw_explore_listlen")|unlet w:netrw_explore_listlen|endif
+  if exists("w:netrw_explore_list")   |unlet w:netrw_explore_list   |endif
+  if exists("w:netrw_explore_bufnr")  |unlet w:netrw_explore_bufnr  |endif
+"   redraw!
+  echo " "
+  echo " "
+"  call Dret("s:NetrwClearExplore")
+endfun
+
+" ---------------------------------------------------------------------
 " netrw#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
-"          dosplit==1: the window will be split before running the local
-"                      browser
+"          indx:  == -1: Nexplore
+"                 == -2: Pexplore
+"                 ==  +: this is overloaded:
+"                      * If Nexplore/Pexplore is in use, then this refers to the
+"                        indx'th item in the w:netrw_explore_list[] of items which
+"                        matched the */pattern **/pattern *//pattern **//pattern
+"                      * If Hexplore or Vexplore, then this will override
+"                        g:netrw_winsize to specify the qty of rows or columns the
+"                        newly split window should have.
+"          dosplit==0: the window will be split iff the current file has been modified
+"          dosplit==1: the window will be split before running the local browser
+"          style == 0: Explore     style == 1: Explore!
+"                == 2: Hexplore    style == 3: Hexplore!
+"                == 4: Vexplore    style == 5: Vexplore!
+"                == 6: Texplore
 fun! netrw#Explore(indx,dosplit,style,...)
 "  call Dfunc("netrw#Explore(indx=".a:indx." dosplit=".a:dosplit." style=".a:style.",a:1<".a:1.">) &modified=".&modified." a:0=".a:0)
   if !exists("b:netrw_curdir")
    let b:netrw_curdir= getcwd()
 "   call Decho("set b:netrw_curdir<".b:netrw_curdir."> (used getcwd)")
   endif
-  let curfile= b:netrw_curdir
-"  call Decho("curfile<".curfile.">")
+  let curdir     = b:netrw_curdir
+  let curfiledir = substitute(expand("%:p"),'^\(.*[/\\]\)[^/\\]*$','\1','e')
+"  call Decho("curdir<".curdir.">  curfiledir<".curfiledir.">")
+"  call FOTEST(1)
 
   " save registers
   silent! let keepregstar = @*
@@ -3083,30 +3395,34 @@
   if a:dosplit || &modified || a:style == 6
 "   call Decho("case: dosplit=".a:dosplit." modified=".&modified." a:style=".a:style)
    call s:SaveWinVars()
+   let winsize= g:netrw_winsize
+   if a:indx > 0
+    let winsize= a:indx
+   endif
 
    if a:style == 0      " Explore, Sexplore
 "    call Decho("style=0: Explore or Sexplore")
-    exe g:netrw_winsize."wincmd s"
+    exe winsize."wincmd s"
 
    elseif a:style == 1  "Explore!, Sexplore!
 "    call Decho("style=1: Explore! or Sexplore!")
-    exe g:netrw_winsize."wincmd v"
+    exe winsize."wincmd v"
 
    elseif a:style == 2  " Hexplore
 "    call Decho("style=2: Hexplore")
-    exe "bel ".g:netrw_winsize."wincmd s"
+    exe "bel ".winsize."wincmd s"
 
    elseif a:style == 3  " Hexplore!
 "    call Decho("style=3: Hexplore!")
-    exe "abo ".g:netrw_winsize."wincmd s"
+    exe "abo ".winsize."wincmd s"
 
    elseif a:style == 4  " Vexplore
 "    call Decho("style=4: Vexplore")
-    exe "lefta ".g:netrw_winsize."wincmd v"
+    exe "lefta ".winsize."wincmd v"
 
    elseif a:style == 5  " Vexplore!
 "    call Decho("style=5: Vexplore!")
-    exe "rightb ".g:netrw_winsize."wincmd v"
+    exe "rightb ".winsize."wincmd v"
 
    elseif a:style == 6  " Texplore
     call s:SaveBufVars()
@@ -3117,6 +3433,7 @@
    call s:RestoreWinVars()
   endif
   norm! 0
+"  call FOTEST(2)
 
   if a:0 > 0
 "   call Decho("case [a:0=".a:0."]>0: a:1<".a:1.">")
@@ -3131,28 +3448,18 @@
 "    call Decho("using dirname<".dirname.">  (case: ".(exists("b:netrw_curdir")? "b:netrw_curdir" : "getcwd()").")")
    elseif a:1 =~ '\$'
     let dirname= expand(a:1)
+"    call Decho("using user-specified dirname<".dirname."> with $env-var")
    else
     let dirname= a:1
-"    call Decho("using dirname<".dirname.">")
+"    call Decho("using user-specified dirname<".dirname.">")
    endif
   else
    " clear explore
-"   call Decho("clearing explore variables")
-   2match none
-   if exists("s:explore_match")        |unlet s:explore_match        |endif
-   if exists("s:explore_indx")         |unlet s:explore_indx         |endif
-   if exists("s:dirstarstar")          |unlet s:dirstarstar          |endif
-   if exists("s:dirstarstar")          |unlet s:dirstarstar          |endif
-   if exists("w:netrw_explore_indx")   |unlet w:netrw_explore_indx   |endif
-   if exists("w:netrw_explore_listlen")|unlet w:netrw_explore_listlen|endif
-   if exists("w:netrw_explore_list")   |unlet w:netrw_explore_list   |endif
-   if exists("w:netrw_explore_bufnr")  |unlet w:netrw_explore_bufnr  |endif
-"   redraw!
-   echo " "
-   echo " "
+   call s:NetrwClearExplore()
 "   call Dret("netrw#Explore : cleared list")
    return
   endif
+"  call FOTEST(3)
 
   if dirname =~ '/\*\*/'
    " handle .../**/.../filepat
@@ -3192,15 +3499,19 @@
    " starpat=4: Explore **/filepat  (recursive descent search for filenames matching filepat)
    let starpat= 4
 "   call Decho("case Explore **/filepat (starpat=".starpat.")")
+
   else
    let starpat= 0
+"   call Decho("default case: starpat=".starpat)
   endif
+"  call FOTEST(4)
 
   if starpat == 0 && a:indx >= 0
    " [Explore Hexplore Vexplore Sexplore] [dirname]
-"   call Decho("case dirname<".dirname."> a:indx=".a:indx.": Explore Hexplore Vexplore Sexplore")
+"   call Decho("case starpat==0 && a:indx=".a:indx.": dirname<".dirname."> Explore Hexplore Vexplore Sexplore")
    if dirname == ""
-    let dirname= substitute(expand("%:p"),'^\(.*[/\\]\)[^/\\]*$','\1','e')
+    let dirname= curfiledir
+"    call Decho("empty dirname, using current file's directory<".dirname.">")
    endif
    if dirname =~ '^scp:' || dirname =~ '^ftp:'
 "    call Decho("calling NetrwBrowse(0,dirname<".dirname.">)")
@@ -3211,11 +3522,11 @@
     call netrw#LocalBrowseCheck(dirname)
    endif
 
-"   call Decho("curfile<".curfile.">")
+"   call Decho("curdir<".curdir.">")
    if has("win32") || has("win95") || has("win64") || has("win16")
-    call search('\<'.substitute(curfile,'^.*[/\\]','','e').'\>','cW')
+    call search('\<'.substitute(curdir,'^.*[/\\]','','e').'\>','cW')
    else
-    call search('\<'.substitute(curfile,'^.*/','','e').'\>','cW')
+    call search('\<'.substitute(curdir,'^.*/','','e').'\>','cW')
    endif
 
   " starpat=1: Explore *//pattern  (current directory only search for files containing pattern)
@@ -3224,7 +3535,7 @@
   " starpat=4: Explore **/filepat  (recursive descent search for filenames matching filepat)
   elseif a:indx <= 0
    " Nexplore, Pexplore, Explore: handle starpat
-"   call Decho("case Nexplore, Pexplore, <s-down>, <s-up>: starpat=".starpat." a:indx=".a:indx)
+"   call Decho("case a:indx<=0: Nexplore, Pexplore, <s-down>, <s-up> starpat=".starpat." a:indx=".a:indx)
    if !mapcheck("<s-up>","n") && !mapcheck("<s-down>","n") && exists("b:netrw_curdir")
 "    call Decho("set up <s-up> and <s-down> maps")
     let s:didstarstar= 1
@@ -3237,9 +3548,10 @@
     if !exists("w:netrw_explore_indx")
      let w:netrw_explore_indx= 0
     endif
+
     let indx = a:indx
 "    call Decho("starpat=".starpat.": set indx= [a:indx=".indx."]")
-"
+
     if indx == -1
      " Nexplore
 "     call Decho("case Nexplore with starpat=".starpat.": (indx=".indx.")")
@@ -3290,6 +3602,7 @@
      " Explore -- initialize
      " build list of files to Explore with Nexplore/Pexplore
 "     call Decho("starpat=".starpat.": case Explore: initialize (indx=".indx.")")
+     call s:NetrwClearExplore()
      let w:netrw_explore_indx= 0
      if !exists("b:netrw_curdir")
       let b:netrw_curdir= getcwd()
@@ -3300,17 +3613,24 @@
      if starpat == 1
       " starpat=1: Explore *//pattern  (current directory only search for files containing pattern)
 "      call Decho("starpat=".starpat.": build *//pattern list")
-      exe "vimgrep /".pattern."/gj ".fnameescape(b:netrw_curdir)."/*"
-      let w:netrw_explore_list = map(getqflist(),'bufname(v:val.bufnr)')
+"      call Decho("pattern<".pattern.">")
+      try
+       exe "noautocmd vimgrep /".pattern."/gj ".fnameescape(b:netrw_curdir)."/*"
+      catch /^Vim\%((\a\+)\)\=:E480/
+       call netrw#ErrorMsg(s:WARNING,"no match with pattern<".pattern.">",76)
+"       call Dret("netrw#Explore : unable to find pattern<".pattern.">")
+       return
+      endtry
+      let w:netrw_explore_list = s:NetrwExploreListUniq(map(getqflist(),'bufname(v:val.bufnr)'))
       if &hls | let keepregslash= s:ExplorePatHls(pattern) | endif
 
      elseif starpat == 2
       " starpat=2: Explore **//pattern (recursive descent search for files containing pattern)
 "      call Decho("starpat=".starpat.": build **//pattern list")
       try
-       exe "silent vimgrep /".pattern."/gj "."**/*"
+       exe "silent noautocmd vimgrep /".pattern."/gj "."**/*"
       catch /^Vim\%((\a\+)\)\=:E480/
-      	call netrw#ErrorMsg(s:WARNING,'no files matched pattern<'.pattern.'>',45)
+       call netrw#ErrorMsg(s:WARNING,'no files matched pattern<'.pattern.'>',45)
        if &hls | let keepregslash= s:ExplorePatHls(pattern) | endif
        silent! let @* = keepregstar
        silent! let @+ = keepregstar
@@ -3320,19 +3640,22 @@
       endtry
       let s:netrw_curdir       = b:netrw_curdir
       let w:netrw_explore_list = getqflist()
-      let w:netrw_explore_list = map(w:netrw_explore_list,'s:netrw_curdir."/".bufname(v:val.bufnr)')
+      let w:netrw_explore_list = s:NetrwExploreListUniq(map(w:netrw_explore_list,'s:netrw_curdir."/".bufname(v:val.bufnr)'))
 
      elseif starpat == 3
       " starpat=3: Explore */filepat   (search in current directory for filenames matching filepat)
 "      call Decho("starpat=".starpat.": build */filepat list")
-      let dirname             = substitute(dirname,'^\*/','','')
-      let w:netrw_explore_list= split(expand(b:netrw_curdir."/".dirname),'\n')
-      if &hls | let keepregslash= s:ExplorePatHls(dirname) | endif
+      let filepat= substitute(dirname,'^\*/','','')
+      let filepat= substitute(filepat,'^[%#<]','\\&','')
+"      call Decho("b:netrw_curdir<".b:netrw_curdir.">")
+"      call Decho("filepat<".filepat.">")
+      let w:netrw_explore_list= s:NetrwExploreListUniq(split(expand(b:netrw_curdir."/".filepat),'\n'))
+      if &hls | let keepregslash= s:ExplorePatHls(filepat) | endif
 
      elseif starpat == 4
       " starpat=4: Explore **/filepat  (recursive descent search for filenames matching filepat)
 "      call Decho("starpat=".starpat.": build **/filepat list")
-      let w:netrw_explore_list= split(expand(b:netrw_curdir."/".dirname),'\n')
+      let w:netrw_explore_list= s:NetrwExploreListUniq(split(expand(b:netrw_curdir."/".dirname),'\n'))
       if &hls | let keepregslash= s:ExplorePatHls(dirname) | endif
      endif " switch on starpat to build w:netrw_explore_list
 
@@ -3352,7 +3675,7 @@
 
     " NetrwStatusLine support - for exploring support
     let w:netrw_explore_indx= indx
-"    call Decho("explorelist<".join(w:netrw_explore_list,',')."> len=".w:netrw_explore_listlen)
+"    call Decho("w:netrw_explore_list<".join(w:netrw_explore_list,',')."> len=".w:netrw_explore_listlen)
 
     " wrap the indx around, but issue a note
     if indx >= w:netrw_explore_listlen || indx < 0
@@ -3360,7 +3683,6 @@
      let indx                = (indx < 0)? ( w:netrw_explore_listlen - 1 ) : 0
      let w:netrw_explore_indx= indx
      call netrw#ErrorMsg(s:NOTE,"no more files match Explore pattern",43)
-     sleep 1
     endif
 
     exe "let dirfile= w:netrw_explore_list[".indx."]"
@@ -3397,7 +3719,7 @@
    endif
 
   else
-"   call Decho("case Explore newdir<".dirname.">")
+"   call Decho("default case: Explore newdir<".dirname.">")
    if exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST && dirname =~ '/'
     silent! unlet w:netrw_treedict
     silent! unlet w:netrw_treetop
@@ -3409,14 +3731,19 @@
     call netrw#LocalBrowseCheck(s:NetrwBrowseChgDir(1,newdir))
    endif
   endif
+"  call FOTEST(5)
 
   " visual display of **/ **// */ Exploration files
+"  call Decho("w:netrw_explore_indx=".(exists("w:netrw_explore_indx")? w:netrw_explore_indx : "doesn't exist"))
+"  call Decho("b:netrw_curdir<".(exists("b:netrw_curdir")? b:netrw_curdir : "n/a").">")
   if exists("w:netrw_explore_indx") && exists("b:netrw_curdir")
+"   call Decho("s:explore_prvdir<".(exists("s:explore_prvdir")? s:explore_prvdir : "-doesn't exist-"))
    if !exists("s:explore_prvdir") || s:explore_prvdir != b:netrw_curdir
     " only update match list if current directory isn't the same as before
+"    call Decho("only update match list if current directory not the same as before")
     let s:explore_prvdir = b:netrw_curdir
     let s:explore_match  = ""
-    let dirlen           = strlen(b:netrw_curdir)
+    let dirlen           = s:Strlen(b:netrw_curdir)
     if b:netrw_curdir !~ '/$'
      let dirlen= dirlen + 1
     endif
@@ -3425,15 +3752,15 @@
 "     call Decho("fname<".fname.">")
      if fname =~ '^'.b:netrw_curdir
       if s:explore_match == ""
-       let s:explore_match= '\<'.escape(strpart(fname,dirlen),g:netrw_markfileesc."'".g:netrw_markfileesc."'").'\>'
+       let s:explore_match= '\<'.escape(strpart(fname,dirlen),g:netrw_markfileesc).'\>'
       else
-       let s:explore_match= s:explore_match.'\|\<'.escape(strpart(fname,dirlen),g:netrw_markfileesc."'".g:netrw_markfileesc."'").'\>'
+       let s:explore_match= s:explore_match.'\|\<'.escape(strpart(fname,dirlen),g:netrw_markfileesc).'\>'
       endif
      elseif fname !~ '^/' && fname != prvfname
       if s:explore_match == ""
-       let s:explore_match= '\<'.escape(fname,g:netrw_markfileesc."'".g:netrw_markfileesc."'").'\>'
+       let s:explore_match= '\<'.escape(fname,g:netrw_markfileesc).'\>'
       else
-       let s:explore_match= s:explore_match.'\|\<'.escape(fname,g:netrw_markfileesc."'".g:netrw_markfileesc."'").'\>'
+       let s:explore_match= s:explore_match.'\|\<'.escape(fname,g:netrw_markfileesc).'\>'
       endif
      endif
      let prvfname= fname
@@ -3449,6 +3776,7 @@
    echo " "
 "   call Decho("cleared explore match list")
   endif
+"  call FOTEST(6)
 
   silent! let @* = keepregstar
   silent! let @+ = keepregstar
@@ -3457,6 +3785,24 @@
 endfun
 
 " ---------------------------------------------------------------------
+" s:NetrwExploreListUniq: {{{2
+fun! s:NetrwExploreListUniq(explist)
+"  call Dfunc("s:NetrwExploreListUniq(explist)")
+
+  " this assumes that the list is already sorted
+  let newexplist= []
+  for member in a:explist
+   if !exists("uniqmember") || member != uniqmember
+    let uniqmember = member
+    let newexplist = newexplist + [ member ]
+   endif
+  endfor
+
+"  call Dret("s:NetrwExploreListUniq")
+  return newexplist
+endfun
+
+" ---------------------------------------------------------------------
 " s:NetrwHide: this function is invoked by the "a" map for browsing {{{2
 "          and switches the hiding mode.  The actual hiding is done by
 "          s:NetrwListHide().
@@ -3490,9 +3836,7 @@
 "     call Decho("hide: g:netrw_list_hide<".g:netrw_list_hide.">")
     endif
    endfor
-   unlet s:netrwmarkfilelist_{bufnr("%")}
-   unlet s:netrwmarkfilemtch_{bufnr("%")}
-   2match none
+   call s:NetrwUnmarkList(bufnr("%"),b:netrw_curdir)
    let g:netrw_hide= 1
 
   else
@@ -3522,7 +3866,7 @@
   if g:netrw_list_hide =~ '\(^\|,\)\\(^\\|\\s\\s\\)\\zs\\.\\S\\+'
    " remove pattern from hiding list
    let g:netrw_list_hide= substitute(g:netrw_list_hide,'\(^\|,\)\\(^\\|\\s\\s\\)\\zs\\.\\S\\+','','')
-  elseif strlen(g:netrw_list_hide) >= 1
+  elseif s:Strlen(g:netrw_list_hide) >= 1
    let g:netrw_list_hide= g:netrw_list_hide . ',\(^\|\s\s\)\zs\.\S\+'
   else
    let g:netrw_list_hide= '\(^\|\s\s\)\zs\.\S\+'
@@ -3535,6 +3879,41 @@
 endfun
 
 " ---------------------------------------------------------------------
+"  s:NetrwHome: this function determines a "home" for saving bookmarks and history {{{2
+fun! s:NetrwHome()
+  if exists("g:netrw_home")
+   let home= g:netrw_home
+  else
+   " go to vim plugin home
+   for home in split(&rtp,',') + ['']
+    if isdirectory(home) && filewritable(home) | break | endif
+     let basehome= substitute(home,'[/\\]\.vim$','','')
+    if isdirectory(basehome) && filewritable(basehome)
+     let home= basehome."/.vim"
+     break
+    endif
+   endfor
+   if home == ""
+    " just pick the first directory
+    let home= substitute(&rtp,',.*$','','')
+   endif
+   if (has("win32") || has("win95") || has("win64") || has("win16"))
+    let home= substitute(home,'/','\\','g')
+   endif
+  endif
+  " insure that the home directory exists
+  if !isdirectory(home)
+   if exists("g:netrw_mkdir")
+    call system(g:netrw_mkdir." ".shellescape(home))
+   else
+    call mkdir(home)
+   endif
+  endif
+  let g:netrw_home= home
+  return home
+endfun
+
+" ---------------------------------------------------------------------
 " s:NetrwLeftmouse: handles the <leftmouse> when in a netrw browsing window {{{2
 fun! s:NetrwLeftmouse(islocal)
 "  call Dfunc("s:NetrwLeftmouse(islocal=".a:islocal.")")
@@ -3749,6 +4128,7 @@
 "  call Dfunc("s:NetrwMarkFile(islocal=".a:islocal." fname<".a:fname.">)")
   let curbufnr= bufnr("%")
   let curdir  = b:netrw_curdir
+  let trailer = '[@=|\/\*]\=\>'
   if exists("s:netrwmarkfilelist_{curbufnr}")
    " markfile list exists
 "   call Decho("starting s:netrwmarkfilelist_{curbufnr}<".string(s:netrwmarkfilelist_{curbufnr}).">")
@@ -3759,7 +4139,7 @@
     " append filename to buffer's markfilelist
 "    call Decho("append filename<".a:fname."> to local markfilelist_".curbufnr."<".string(s:netrwmarkfilelist_{curbufnr}).">")
     call add(s:netrwmarkfilelist_{curbufnr},a:fname)
-    let s:netrwmarkfilemtch_{curbufnr}= s:netrwmarkfilemtch_{curbufnr}.'\|\<'.escape(a:fname,g:netrw_markfileesc."'".g:netrw_markfileesc."'").'\>'
+    let s:netrwmarkfilemtch_{curbufnr}= s:netrwmarkfilemtch_{curbufnr}.'\|\<'.escape(a:fname,g:netrw_markfileesc."'".g:netrw_markfileesc."'").trailer
 
    else
     " remove filename from buffer's markfilelist
@@ -3767,7 +4147,7 @@
     call filter(s:netrwmarkfilelist_{curbufnr},'v:val != a:fname')
     if s:netrwmarkfilelist_{curbufnr} == []
      " local markfilelist is empty; remove it entirely
-"     call Decho("markfile list now empty, unlet s:netrwmarkfilelist_".curbufnr." and ...mtch_".curbufnr)
+"     call Decho("markfile list now empty")
      call s:NetrwUnmarkList(curbufnr,curdir)
     else
      " rebuild match list to display markings correctly
@@ -3776,9 +4156,9 @@
      let first                           = 1
      for fname in s:netrwmarkfilelist_{curbufnr}
       if first
-       let s:netrwmarkfilemtch_{curbufnr}= s:netrwmarkfilemtch_{curbufnr}.'\<'.escape(fname,g:netrw_markfileesc."'".g:netrw_markfileesc."'").'\>'
+       let s:netrwmarkfilemtch_{curbufnr}= s:netrwmarkfilemtch_{curbufnr}.'\<'.escape(fname,g:netrw_markfileesc."'".g:netrw_markfileesc."'").trailer
       else
-       let s:netrwmarkfilemtch_{curbufnr}= s:netrwmarkfilemtch_{curbufnr}.'\|\<'.escape(fname,g:netrw_markfileesc."'".g:netrw_markfileesc."'").'\>'
+       let s:netrwmarkfilemtch_{curbufnr}= s:netrwmarkfilemtch_{curbufnr}.'\|\<'.escape(fname,g:netrw_markfileesc."'".g:netrw_markfileesc."'").trailer
       endif
       let first= 0
      endfor
@@ -3799,7 +4179,7 @@
    if a:fname =~ '/$'
     let s:netrwmarkfilemtch_{curbufnr}= '\<'.escape(a:fname,g:netrw_markfileesc)
    else
-    let s:netrwmarkfilemtch_{curbufnr}= '\<'.escape(a:fname,g:netrw_markfileesc).'\>'
+    let s:netrwmarkfilemtch_{curbufnr}= '\<'.escape(a:fname,g:netrw_markfileesc).trailer
    endif
 "   call Decho("ending s:netrwmarkfilemtch_".curbufnr."<".s:netrwmarkfilemtch_{curbufnr}.">")
   endif
@@ -3830,7 +4210,9 @@
   " set up 2match'ing to netrwmarkfilemtch list
   if exists("s:netrwmarkfilemtch_{curbufnr}") && s:netrwmarkfilemtch_{curbufnr} != ""
 "   call Decho("exe 2match netrwMarkFile /".s:netrwmarkfilemtch_{curbufnr}."/")
-   exe "2match netrwMarkFile /".s:netrwmarkfilemtch_{curbufnr}."/"
+   if exists("g:did_drchip_netrwlist_syntax")
+    exe "2match netrwMarkFile /".s:netrwmarkfilemtch_{curbufnr}."/"
+   endif
   else
 "   call Decho("2match none")
    2match none
@@ -3858,7 +4240,7 @@
     for sfx in sort(keys(g:netrw_decompress))
      if fname =~ '\'.sfx.'$'
       " fname has a suffix indicating that its compressed; apply associated decompression routine
-      let exe= s:WinPath(g:netrw_decompress[sfx])
+      let exe= netrw#WinPath(g:netrw_decompress[sfx])
 "      call Decho("fname<".fname."> is compressed so decompress with <".exe.">")
       if a:islocal
        if g:netrw_keepdir
@@ -3883,10 +4265,10 @@
      unlet exe
     elseif a:islocal
      " fname not a compressed file, so compress it
-     call system(s:WinPath(g:netrw_compress)." ".shellescape(s:ComposePath(b:netrw_curdir,fname)))
+     call system(netrw#WinPath(g:netrw_compress)." ".shellescape(s:ComposePath(b:netrw_curdir,fname)))
     else
      " fname not a compressed file, so compress it
-     call s:RemoteSystem(s:WinPath(g:netrw_compress)." ".shellescape(fname))
+     call s:RemoteSystem(netrw#WinPath(g:netrw_compress)." ".shellescape(fname))
     endif
    endfor
    call s:NetrwUnmarkList(curbufnr,curdir)
@@ -3927,7 +4309,7 @@
 "   call Decho("copy from local to local")
    let args= join(map(deepcopy(s:netrwmarkfilelist_{bufnr('%')}),"shellescape(b:netrw_curdir.\"/\".v:val)"))
 "   call Decho("system(".g:netrw_localcopycmd." ".args." ".shellescape(s:netrwmftgt).")")
-   call system(s:WinPath(g:netrw_localcopycmd)." ".args." ".shellescape(s:netrwmftgt))
+   call system(netrw#WinPath(g:netrw_localcopycmd)." ".args." ".shellescape(s:netrwmftgt))
 
   elseif  a:islocal && !s:netrwmftgt_islocal
    " Copy marked files, local directory to remote directory
@@ -3982,7 +4364,9 @@
   if a:islocal
    call s:NetrwRefreshDir(a:islocal,b:netrw_curdir)
   endif
-  call s:LocalBrowseShellCmdRefresh()
+  if g:netrw_fastbrowse <= 1
+   call s:LocalBrowseShellCmdRefresh()
+  endif
   
 "  call Dret("s:NetrwMarkFileCopy 1")
   return 1
@@ -4064,10 +4448,10 @@
    for fname in s:netrwmarkfilelist_{curbufnr}
     if a:islocal
      if g:netrw_keepdir
-      let fname= shellescape(s:WinPath(s:ComposePath(curdir,fname)))
+      let fname= shellescape(netrw#WinPath(s:ComposePath(curdir,fname)))
      endif
     else
-     let fname= shellescape(s:WinPath(b:netrw_curdir.fname))
+     let fname= shellescape(netrw#WinPath(b:netrw_curdir.fname))
     endif
     if cmd =~ '%'
      let xcmd= substitute(cmd,'%',fname,'g')
@@ -4185,7 +4569,13 @@
 
    " use vimgrep for both local and remote
 "   call Decho("exe vimgrep".pat." ".netrwmarkfilelist)
-   exe "vimgrep".pat." ".netrwmarkfilelist
+   try
+    exe "noautocmd vimgrep".pat." ".netrwmarkfilelist
+    catch /^Vim\%((\a\+)\)\=:E480/
+     call netrw#ErrorMsg(s:WARNING,"no match with pattern<".pattern.">",76)
+"     call Dret("s:NetrwMarkFileGrep : unable to find pattern<".pattern.">")
+     return
+   endtry
 
    2match none
    call netrw#NetrwRestorePosn(svpos)
@@ -4290,7 +4680,9 @@
   if a:islocal
    call s:NetrwRefreshDir(a:islocal,b:netrw_curdir)
   endif
-  call s:LocalBrowseShellCmdRefresh()
+  if g:netrw_fastbrowse <= 1
+   call s:LocalBrowseShellCmdRefresh()
+  endif
   
 "  call Dret("s:NetrwMarkFileMove")
 endfun
@@ -4342,24 +4734,15 @@
    " get the matching list of files using local glob()
 "   call Decho("handle local regexp")
    let dirname  = escape(b:netrw_curdir,g:netrw_glob_escape)
-   let filelist = glob(s:ComposePath(dirname,regexp))
-   if filelist != ""
-    let filelist= filelist."\n"
-   endif
+   let files = glob(s:ComposePath(dirname,regexp))
+"   call Decho("files<".files.">")
+   let filelist= split(files,"\n")
 
   " mark the list of files
-  while filelist != ""
-   if filelist =~ '\n'
-    let filename = substitute(filelist,'\n.*$','','e')
-    let filelist = substitute(filelist,'^.\{-}\n\(.*\)$','\1','e')
-   else
-    let filename = filelist
-    let filelist = ""
-   endif
-"   call Decho("filelist<".filelist.">")
-"   call Decho("filename<".filename.">")
-   call s:NetrwMarkFile(a:islocal,substitute(filename,'^.*/','',''))
-  endwhile
+  for fname in filelist
+"   call Decho("fname<".fname.">")
+   call s:NetrwMarkFile(a:islocal,substitute(fname,'^.*/','',''))
+  endfor
 
   else
 "   call Decho("handle remote regexp")
@@ -4371,7 +4754,8 @@
    set ei=all ma
 "   call Decho("set ei=all ma")
    1split
-   enew
+   call s:NetrwEnew()
+   call s:NetrwSafeOptions()
    silent norm! "ap
    2
    let bannercnt= search('^" =====','W')
@@ -4379,16 +4763,21 @@
    set bt=nofile
    if     g:netrw_liststyle == s:LONGLIST
     silent %s/\s\{2,}\S.*$//e
+    call histdel("/",-1)
    elseif g:netrw_liststyle == s:WIDELIST
     silent %s/\s\{2,}/\r/ge
+    call histdel("/",-1)
    elseif g:netrw_liststyle == s:TREELIST
     silent %s/^| //e
     silent! g/^ .*$/d
+    call histdel("/",-1)
+    call histdel("/",-1)
    endif
    " convert regexp into the more usual glob-style format
    let regexp= substitute(regexp,'\*','.*','g')
 "   call Decho("regexp<".regexp.">")
    exe "silent! v/".escape(regexp,'/')."/d"
+   call histdel("/",-1)
    let filelist= getline(1,line("$"))
    q!
    for filename in filelist
@@ -4459,6 +4848,7 @@
     let path= substitute(curdir,'^\(.*\)/[^/]*$','\1/','')
 "    call Decho("curdir<".curdir."> path<".path.">")
     exe '%s/\t\(\S\+\)\t/\t'.escape(path,"/\n\r\\").'\1\t/e'
+    call histdel("/",-1)
     wq!
    endif
    2match none
@@ -4518,7 +4908,7 @@
   endif
   let s:netrwmftgt_islocal= a:islocal
 
-  if g:netrw_fastbrowse > 0
+  if g:netrw_fastbrowse <= 1
    call s:LocalBrowseShellCmdRefresh()
   endif
   call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./'))
@@ -4653,20 +5043,17 @@
 "    call Decho("initialize menu")
     let s:netrw_menu_enabled= 1
     exe 'silent! menu '.g:NetrwMenuPriority.'.1     '.g:NetrwTopLvlMenu.'Help<tab><F1>	<F1>'
-    call s:NetrwBookmarkMenu() " provide some history!  uses priorities 2,3, reserves 4
     exe 'silent! menu '.g:NetrwMenuPriority.'.5     '.g:NetrwTopLvlMenu.'-Sep1-	:'
     exe 'silent! menu '.g:NetrwMenuPriority.'.6     '.g:NetrwTopLvlMenu.'Go\ Up\ Directory<tab>-	-'
     exe 'silent! menu '.g:NetrwMenuPriority.'.7     '.g:NetrwTopLvlMenu.'Apply\ Special\ Viewer<tab>x	x'
     exe 'silent! menu '.g:NetrwMenuPriority.'.8.1   '.g:NetrwTopLvlMenu.'Bookmarks\ and\ History.Bookmark\ Current\ Directory<tab>mb	mb'
-    exe 'silent! menu '.g:NetrwMenuPriority.'.8.2   '.g:NetrwTopLvlMenu.'Bookmarks\ and\ History.Bookmark\ Delete<tab>mB	mB'
-    exe 'silent! menu '.g:NetrwMenuPriority.'.8.3   '.g:NetrwTopLvlMenu.'Bookmarks\ and\ History.Goto\ Bookmark<tab>gb	gb'
     exe 'silent! menu '.g:NetrwMenuPriority.'.8.4   '.g:NetrwTopLvlMenu.'Bookmarks\ and\ History.Goto\ Prev\ Dir\ (History)<tab>u	u'
     exe 'silent! menu '.g:NetrwMenuPriority.'.8.5   '.g:NetrwTopLvlMenu.'Bookmarks\ and\ History.Goto\ Next\ Dir\ (History)<tab>U	U'
     exe 'silent! menu '.g:NetrwMenuPriority.'.8.6   '.g:NetrwTopLvlMenu.'Bookmarks\ and\ History.List<tab>qb	qb'
-    exe 'silent! menu '.g:NetrwMenuPriority.'.9.1   '.g:NetrwTopLvlMenu.'Browsing\ Control.Edit\ File\ Hiding\ List<tab>'."<ctrl-h>	\<Plug>NetrwHideEdit"
+    exe 'silent! menu '.g:NetrwMenuPriority.'.9.1   '.g:NetrwTopLvlMenu.'Browsing\ Control.Edit\ File\ Hiding\ List<tab><ctrl-h>'."	\<c-h>'"
     exe 'silent! menu '.g:NetrwMenuPriority.'.9.2   '.g:NetrwTopLvlMenu.'Browsing\ Control.Edit\ Sorting\ Sequence<tab>S	S'
     exe 'silent! menu '.g:NetrwMenuPriority.'.9.3   '.g:NetrwTopLvlMenu.'Browsing\ Control.Quick\ Hide/Unhide\ Dot\ Files<tab>'."gh	gh"
-    exe 'silent! menu '.g:NetrwMenuPriority.'.9.4   '.g:NetrwTopLvlMenu.'Browsing\ Control.Refresh\ Listing<tab>'."<ctrl-l>	\<Plug>NetrwRefresh"
+    exe 'silent! menu '.g:NetrwMenuPriority.'.9.4   '.g:NetrwTopLvlMenu.'Browsing\ Control.Refresh\ Listing<tab>'."<ctrl-l>	\<c-l>"
     exe 'silent! menu '.g:NetrwMenuPriority.'.9.5   '.g:NetrwTopLvlMenu.'Browsing\ Control.Settings/Options<tab>:NetrwSettings	'.":NetrwSettings\<cr>"
     exe 'silent! menu '.g:NetrwMenuPriority.'.10    '.g:NetrwTopLvlMenu.'Delete\ File/Directory<tab>D	D'
     exe 'silent! menu '.g:NetrwMenuPriority.'.11.1  '.g:NetrwTopLvlMenu.'Edit\ File/Dir.In\ Current\ Window<tab><cr>	'."\<cr>"
@@ -4677,8 +5064,8 @@
     exe 'silent! menu '.g:NetrwMenuPriority.'.12.1  '.g:NetrwTopLvlMenu.'Explore.Directory\ Name	:Explore '
     exe 'silent! menu '.g:NetrwMenuPriority.'.12.2  '.g:NetrwTopLvlMenu.'Explore.Filenames\ Matching\ Pattern\ (curdir\ only)<tab>:Explore\ */	:Explore */'
     exe 'silent! menu '.g:NetrwMenuPriority.'.12.2  '.g:NetrwTopLvlMenu.'Explore.Filenames\ Matching\ Pattern\ (+subdirs)<tab>:Explore\ **/	:Explore **/'
-    exe 'silent! menu '.g:NetrwMenuPriority.'.12.3  '.g:NetrwTopLvlMenu.'Explore.Files\ Containing\ Pattern\ (curdir\ only)<tab>:Explore\ *//	:Explore *//'
-    exe 'silent! menu '.g:NetrwMenuPriority.'.12.4  '.g:NetrwTopLvlMenu.'Explore.Files\ Containing\ Pattern\ (+subdirs)<tab>:Explore\ **//	:Explore **//'
+    exe 'silent! menu '.g:NetrwMenuPriority.'.12.3  '.g:NetrwTopLvlMenu.'Explore.Files\ Containing\ String\ Pattern\ (curdir\ only)<tab>:Explore\ *//	:Explore *//'
+    exe 'silent! menu '.g:NetrwMenuPriority.'.12.4  '.g:NetrwTopLvlMenu.'Explore.Files\ Containing\ String\ Pattern\ (+subdirs)<tab>:Explore\ **//	:Explore **//'
     exe 'silent! menu '.g:NetrwMenuPriority.'.12.4  '.g:NetrwTopLvlMenu.'Explore.Next\ Match<tab>:Nexplore	:Nexplore<cr>'
     exe 'silent! menu '.g:NetrwMenuPriority.'.12.4  '.g:NetrwTopLvlMenu.'Explore.Prev\ Match<tab>:Pexplore	:Pexplore<cr>'
     exe 'silent! menu '.g:NetrwMenuPriority.'.13    '.g:NetrwTopLvlMenu.'Make\ Subdirectory<tab>d	d'
@@ -4704,6 +5091,7 @@
     exe 'silent! menu '.g:NetrwMenuPriority.'.16.4  '.g:NetrwTopLvlMenu.'Style.Sorting\ Method\ (name-time-size)<tab>s	s'
     exe 'silent! menu '.g:NetrwMenuPriority.'.17    '.g:NetrwTopLvlMenu.'Rename\ File/Directory<tab>R	R'
     exe 'silent! menu '.g:NetrwMenuPriority.'.18    '.g:NetrwTopLvlMenu.'Set\ Current\ Directory<tab>c	c'
+    call s:NetrwBookmarkMenu() " provide some history!  uses priorities 2,3, reserves 4, 8.2.x
     let s:netrw_menucnt= 28
 
    elseif !a:domenu
@@ -4731,8 +5119,8 @@
 "  call Dfunc("NetrwObtain(islocal=".a:islocal.")")
 
   if exists("s:netrwmarkfilelist_{bufnr('%')}")
-   let islocal= s:netrwmarkfilelist_{bufnr("%")}[1] !~ '^\a\+://'
-   call netrw#NetrwObtain(islocal,s:netrwmarkfilelist_{bufnr("%")})
+   let islocal= s:netrwmarkfilelist_{bufnr('%')}[1] !~ '^\a\+://'
+   call netrw#NetrwObtain(islocal,s:netrwmarkfilelist_{bufnr('%')})
    call s:NetrwUnmarkList(bufnr('%'),b:netrw_curdir)
   else
    call netrw#NetrwObtain(a:islocal,expand("<cWORD>"))
@@ -4769,7 +5157,7 @@
   endif
 "  call Decho("tgtdir<".tgtdir.">")
 
-  if b:netrw_islocal
+  if exists("b:netrw_islocal") && b:netrw_islocal
    " obtain a file from local b:netrw_curdir to (local) tgtdir
 "   call Decho("obtain a file from local ".b:netrw_curdir." to ".tgtdir)
    if exists("b:netrw_curdir") && getcwd() != b:netrw_curdir
@@ -4921,6 +5309,14 @@
       call netrw#ErrorMsg(s:ERROR,getline(1),5)
      endif
     endif
+   elseif !exists("b:netrw_method") || b:netrw_method < 0
+"    call Dfunc("netrw#NetrwObtain : unsupported method")
+    return
+   endif
+
+   " restore status line
+   if type(a:fname) == 1 && exists("s:netrw_users_stl")
+    call s:SetupNetrwStatusLine(s:netrw_users_stl)
    endif
 
   endif
@@ -4989,8 +5385,8 @@
     let &ei= eikeep
 "    call Decho("bnr=".bnr." bnrcnt=".bnrcnt." buftype=".&bt." winnr#".winnr())
     if bnrcnt == 1
-     let bufname= bufname(winbufnr(winnr()))
-     let choice= confirm("Save modified file<".bufname.">?","&Yes\n&No\n&Cancel")
+     let bufname = bufname(winbufnr(winnr()))
+     let choice  = confirm("Save modified file<".bufname.">?","&Yes\n&No\n&Cancel")
 "     call Decho("bufname<".bufname."> choice=".choice." winnr#".winnr())
 
      if choice == 1
@@ -5138,6 +5534,7 @@
      endif
      " If the result of the ftp operation isn't blank, show an error message (tnx to Doug Claar)
      silent g/Local directory now/d
+     call histdel("/",-1)
      if getline(1) !~ "^$" && !exists("g:netrw_quiet") && getline(1) !~ '^Trying '
       call netrw#ErrorMsg(s:ERROR,getline(1),14)
      else
@@ -5196,6 +5593,7 @@
      exe s:netrw_silentxfer."%!".g:netrw_ftp_cmd." -i -n"
      " If the result of the ftp operation isn't blank, show an error message (tnx to Doug Claar)
      silent g/Local directory now/d
+     call histdel("/",-1)
      if getline(1) !~ "^$" && !exists("g:netrw_quiet") && getline(1) !~ '^Trying '
       let debugkeep= &debug
       setlocal debug=msg
@@ -5205,6 +5603,9 @@
      else
       bw!|q
      endif
+    elseif !exists("b:netrw_method") || b:netrw_method < 0
+"     call Dfunc("netrw#NetrwUpload : unsupported method")
+     return
     endif
    else
     call netrw#ErrorMsg(s:ERROR,"can't obtain files with protocol from<".a:tgt.">",63)
@@ -5325,13 +5726,12 @@
     let seq     = seqlist
     let seqlist = ""
    endif
-   let sepchr= "\<Char-0xff>"
    if priority < 10
-    let spriority= "00".priority.sepchr
+    let spriority= "00".priority.g:netrw_sepchr
    elseif priority < 100
-    let spriority= "0".priority.sepchr
+    let spriority= "0".priority.g:netrw_sepchr
    else
-    let spriority= priority.sepchr
+    let spriority= priority.g:netrw_sepchr
    endif
 "   call Decho("priority=".priority." spriority<".spriority."> seq<".seq."> seqlist<".seqlist.">")
 
@@ -5345,14 +5745,17 @@
     let starpriority= spriority
    else
     exe 'silent keepjumps '.w:netrw_bannercnt.',$g/'.seq.'/s/^/'.spriority.'/'
+    call histdel("/",-1)
     " sometimes multiple sorting patterns will match the same file or directory.
     " The following substitute is intended to remove the excess matches.
-    exe 'silent keepjumps '.w:netrw_bannercnt.',$g/^\d\{3}'.sepchr.'\d\{3}\//s/^\d\{3}'.sepchr.'\(\d\{3}\/\).\@=/\1/e'
+    exe 'silent keepjumps '.w:netrw_bannercnt.',$g/^\d\{3}'.g:netrw_sepchr.'\d\{3}\//s/^\d\{3}'.g:netrw_sepchr.'\(\d\{3}\/\).\@=/\1/e'
+    call histdel("/",-1)
    endif
    let priority = priority + 1
   endwhile
   if exists("starpriority")
-   exe 'silent keepjumps '.w:netrw_bannercnt.',$v/^\d\{3}'.sepchr.'/s/^/'.starpriority.'/'
+   exe 'silent keepjumps '.w:netrw_bannercnt.',$v/^\d\{3}'.g:netrw_sepchr.'/s/^/'.starpriority.'/'
+   call histdel("/",-1)
   endif
 
   " Following line associated with priority -- items that satisfy a priority
@@ -5361,7 +5764,8 @@
   " priority pattern needs to be retained.  So, at this point, these excess
   " priority prefixes need to be removed, but not directories that happen to
   " be just digits themselves.
-  exe 'silent keepjumps '.w:netrw_bannercnt.',$s/^\(\d\{3}'.sepchr.'\)\%(\d\{3}'.sepchr.'\)\+\ze./\1/e'
+  exe 'silent keepjumps '.w:netrw_bannercnt.',$s/^\(\d\{3}'.g:netrw_sepchr.'\)\%(\d\{3}'.g:netrw_sepchr.'\)\+\ze./\1/e'
+  call histdel("/",-1)
 
 "  call Dret("SetSort")
 endfun
@@ -5405,12 +5809,12 @@
 
   elseif a:mode == 1
    " remote and t
-   let cursorword  = s:NetrwGetWord()
+   let newdir  = s:NetrwBrowseChgDir(0,s:NetrwGetWord())
 "   call Decho("tabnew")
    tabnew
    let s:didsplit= 1
    call s:RestoreWinVars()
-   call s:NetrwBrowse(0,s:NetrwBrowseChgDir(0,cursorword))
+   call s:NetrwBrowse(0,newdir)
    unlet s:didsplit
 
   elseif a:mode == 2
@@ -5433,8 +5837,8 @@
 
   elseif a:mode == 4
    " local and t
-   let netrw_curdir= b:netrw_curdir
    let cursorword  = s:NetrwGetWord()
+   let netrw_curdir= s:NetrwTreeDir()
 "   call Decho("tabnew")
    tabnew
    let b:netrw_curdir= netrw_curdir
@@ -5505,12 +5909,13 @@
   if w:netrw_liststyle == s:TREELIST
 "   call Decho("w:netrrw_liststyle is TREELIST:")
 "   call Decho("line#".line(".")." getline(.)<".getline('.')."> treecurpos<".string(s:treecurpos).">")
+
+   " extract tree directory if on a line specifying a subdirectory (ie. ends with "/")
    if getline('.') =~ '/$'
     let treedir= substitute(getline('.'),'^\%(| \)*\([^|].\{-}\)$','\1','e')
    else
     let treedir= ""
    endif
-
 "   call Decho("treedir<".treedir.">")
 
    " detect user attempting to close treeroot
@@ -5525,11 +5930,11 @@
 
    " elide all non-depth information
    let depth = substitute(getline('.'),'^\(\%(| \)*\)[^|].\{-}$','\1','e')
-"   call Decho("depth<".depth."> 1st subst")
+"   call Decho("depth<".depth."> 1st subst (non-depth info removed)")
 
    " elide first depth
    let depth = substitute(depth,'^| ','','')
-"   call Decho("depth<".depth."> 2nd subst")
+"   call Decho("depth<".depth."> 2nd subst (first depth removed)")
 
    " construct treedir by searching backwards at correct depth
 "   call Decho("constructing treedir<".treedir."> depth<".depth.">")
@@ -5548,11 +5953,6 @@
   endif
   let treedir= substitute(treedir,'//$','/','')
 
-"  " now force a refresh
-"" call DECHO("clear buffer<".expand("%")."> with :%d")
-"  setlocal ma noro
-"  keepjumps %d
-
 "  call Dret("NetrwTreeDir <".treedir."> : (side effect) s:treecurpos<".string(s:treecurpos).">")
   return treedir
 endfun
@@ -5663,30 +6063,32 @@
   if w:netrw_liststyle == s:WIDELIST
 "   call Dfunc("NetrwWideListing() w:netrw_liststyle=".w:netrw_liststyle.' fo='.&fo.' l:fo='.&l:fo)
    " look for longest filename (cpf=characters per filename)
-   " cpf: characters per file
-   " fpl: files per line
-   " fpc: files per column
+   " cpf: characters per filename
+   " fpl: filenames per line
+   " fpc: filenames per column
    setlocal ma noro
 "   call Decho("setlocal ma noro")
    let b:netrw_cpf= 0
    if line("$") >= w:netrw_bannercnt
     exe 'silent keepjumps '.w:netrw_bannercnt.',$g/^./if virtcol("$") > b:netrw_cpf|let b:netrw_cpf= virtcol("$")|endif'
+    call histdel("/",-1)
    else
 "    call Dret("NetrwWideListing")
     return
    endif
-"   call Decho("max file strlen+1=".b:netrw_cpf)
-   let b:netrw_cpf= b:netrw_cpf + 1
+   let b:netrw_cpf= b:netrw_cpf + 2
+"   call Decho("b:netrw_cpf=max_filename_length+2=".b:netrw_cpf)
 
    " determine qty files per line (fpl)
    let w:netrw_fpl= winwidth(0)/b:netrw_cpf
    if w:netrw_fpl <= 0
     let w:netrw_fpl= 1
    endif
-"   call Decho("fpl= ".winwidth(0)."/[b:netrw_cpf=".b:netrw_cpf.']='.w:netrw_fpl)
+"   call Decho("fpl= [winwidth=".winwidth(0)."]/[b:netrw_cpf=".b:netrw_cpf.']='.w:netrw_fpl)
 
    " make wide display
    exe 'silent keepjumps '.w:netrw_bannercnt.',$s/^.*$/\=escape(printf("%-'.b:netrw_cpf.'s",submatch(0)),"\\")/'
+   call histdel("/",-1)
    let fpc         = (line("$") - w:netrw_bannercnt + w:netrw_fpl)/w:netrw_fpl
    let newcolstart = w:netrw_bannercnt + fpc
    let newcolend   = newcolstart + fpc - 1
@@ -5706,6 +6108,7 @@
    endwhile
    silent! let @*= keepregstar
    exe "silent keepjumps ".w:netrw_bannercnt.',$s/\s\+$//e'
+   call histdel("/",-1)
    setlocal noma nomod ro
 "   call Dret("NetrwWideListing")
   endif
@@ -5733,16 +6136,21 @@
   endif
 
   " save current directory on directory history list
-  call s:NetrwBookmarkDir(3,b:netrw_curdir)
+  call s:NetrwBookHistHandler(3,b:netrw_curdir)
 
   " Set up the banner {{{3
-"  call Decho("set up banner")
-  keepjumps put ='\" ============================================================================'
-  keepjumps put ='\" Netrw Directory Listing                                        (netrw '.g:loaded_netrw.')'
-  keepjumps put ='\"   '.b:netrw_curdir
-  keepjumps 1d
-  let w:netrw_bannercnt= 3
-  exe "keepjumps ".w:netrw_bannercnt
+  if g:netrw_banner
+"   call Decho("set up banner")
+   keepjumps put ='\" ============================================================================'
+   keepjumps put ='\" Netrw Directory Listing                                        (netrw '.g:loaded_netrw.')'
+   keepjumps put ='\"   '.b:netrw_curdir
+   keepjumps 1d
+   let w:netrw_bannercnt= 3
+   exe "keepjumps ".w:netrw_bannercnt
+  else
+   keepjumps 1
+   let w:netrw_bannercnt= 1
+  endif
 
   let sortby= g:netrw_sort_by
   if g:netrw_sort_direction =~ "^r"
@@ -5750,55 +6158,63 @@
   endif
 
   " Sorted by... {{{3
-"  call Decho("handle specified sorting: g:netrw_sort_by<".g:netrw_sort_by.">")
-  if g:netrw_sort_by =~ "^n"
+  if g:netrw_banner
+"   call Decho("handle specified sorting: g:netrw_sort_by<".g:netrw_sort_by.">")
+   if g:netrw_sort_by =~ "^n"
 "   call Decho("directories will be sorted by name")
-   " sorted by name
-   keepjumps put ='\"   Sorted by      '.sortby
-   keepjumps put ='\"   Sort sequence: '.g:netrw_sort_sequence
-   let w:netrw_bannercnt= w:netrw_bannercnt + 2
-  else
+    " sorted by name
+    keepjumps put ='\"   Sorted by      '.sortby
+    keepjumps put ='\"   Sort sequence: '.g:netrw_sort_sequence
+    let w:netrw_bannercnt= w:netrw_bannercnt + 2
+   else
 "   call Decho("directories will be sorted by size or time")
-   " sorted by size or date
-   keepjumps put ='\"   Sorted by '.sortby
-   let w:netrw_bannercnt= w:netrw_bannercnt + 1
+    " sorted by size or date
+    keepjumps put ='\"   Sorted by '.sortby
+    let w:netrw_bannercnt= w:netrw_bannercnt + 1
+   endif
+   exe "keepjumps ".w:netrw_bannercnt
   endif
-  exe "keepjumps ".w:netrw_bannercnt
 
   " show copy/move target, if any
-  if exists("s:netrwmftgt") && exists("s:netrwmftgt_islocal")
-"   call Decho("show copy/move target<".s:netrwmftgt.">")
-   keepjumps put =''
-   if s:netrwmftgt_islocal
-    call setline(line("."),'"   Copy/Move Tgt: '.s:netrwmftgt.' (local)')
+  if g:netrw_banner
+   if exists("s:netrwmftgt") && exists("s:netrwmftgt_islocal")
+"    call Decho("show copy/move target<".s:netrwmftgt.">")
+    keepjumps put =''
+    if s:netrwmftgt_islocal
+     call setline(line("."),'"   Copy/Move Tgt: '.s:netrwmftgt.' (local)')
+    else
+     call setline(line("."),'"   Copy/Move Tgt: '.s:netrwmftgt.' (remote)')
+    endif
+    let w:netrw_bannercnt= w:netrw_bannercnt + 1
    else
-    call setline(line("."),'"   Copy/Move Tgt: '.s:netrwmftgt.' (remote)')
+"    call Decho("s:netrwmftgt does not exist, don't make Copy/Move Tgt")
    endif
-   let w:netrw_bannercnt= w:netrw_bannercnt + 1
-  else
-"   call Decho("s:netrwmftgt does not exist, don't make Copy/Move Tgt")
+   exe "keepjumps ".w:netrw_bannercnt
   endif
-  exe "keepjumps ".w:netrw_bannercnt
 
   " Hiding...  -or-  Showing... {{{3
-"  call Decho("handle hiding/showing (g:netrw_hide=".g:netrw_list_hide." g:netrw_list_hide<".g:netrw_list_hide.">)")
-  if g:netrw_list_hide != "" && g:netrw_hide
-   if g:netrw_hide == 1
-    keepjumps put ='\"   Hiding:        '.g:netrw_list_hide
-   else
-    keepjumps put ='\"   Showing:       '.g:netrw_list_hide
+  if g:netrw_banner
+"   call Decho("handle hiding/showing (g:netrw_hide=".g:netrw_list_hide." g:netrw_list_hide<".g:netrw_list_hide.">)")
+   if g:netrw_list_hide != "" && g:netrw_hide
+    if g:netrw_hide == 1
+     keepjumps put ='\"   Hiding:        '.g:netrw_list_hide
+    else
+     keepjumps put ='\"   Showing:       '.g:netrw_list_hide
+    endif
+    let w:netrw_bannercnt= w:netrw_bannercnt + 1
    endif
-   let w:netrw_bannercnt= w:netrw_bannercnt + 1
+   exe "keepjumps ".w:netrw_bannercnt
+   keepjumps put ='\"   Quick Help: <F1>:help  -:go up dir  D:delete  R:rename  s:sort-by  x:exec'
+   keepjumps put ='\" ============================================================================'
+   let w:netrw_bannercnt= w:netrw_bannercnt + 2
   endif
-  exe "keepjumps ".w:netrw_bannercnt
-  keepjumps put ='\"   Quick Help: <F1>:help  -:go up dir  D:delete  R:rename  s:sort-by  x:exec'
-  keepjumps put ='\" ============================================================================'
-  let w:netrw_bannercnt= w:netrw_bannercnt + 2
 
   " bannercnt should index the line just after the banner
-  let w:netrw_bannercnt= w:netrw_bannercnt + 1
-  exe "keepjumps ".w:netrw_bannercnt
-"  call Decho("bannercnt=".w:netrw_bannercnt." (should index line just after banner) line($)=".line("$"))
+  if g:netrw_banner
+   let w:netrw_bannercnt= w:netrw_bannercnt + 1
+   exe "keepjumps ".w:netrw_bannercnt
+"   call Decho("bannercnt=".w:netrw_bannercnt." (should index line just after banner) line($)=".line("$"))
+  endif
 
   " set up syntax highlighting {{{3
 "  call Decho("set up syntax highlighting")
@@ -5816,23 +6232,23 @@
   else " remote
    call s:NetrwRemoteListing()
   endif
-"  call Decho("w:netrw_bannercnt=".w:netrw_bannercnt." (banner complete)")
+"  call Decho("g:netrw_banner=".g:netrw_banner." w:netrw_bannercnt=".w:netrw_bannercnt." (banner complete)")
 
   " manipulate the directory listing (hide, sort) {{{3
-  if line("$") >= w:netrw_bannercnt
+  if !g:netrw_banner || line("$") >= w:netrw_bannercnt
 "   call Decho("manipulate directory listing (hide)")
 "   call Decho("g:netrw_hide=".g:netrw_hide." g:netrw_list_hide<".g:netrw_list_hide.">")
    if g:netrw_hide && g:netrw_list_hide != ""
     call s:NetrwListHide()
    endif
-   if line("$") >= w:netrw_bannercnt
+   if !g:netrw_banner || line("$") >= w:netrw_bannercnt
 "    call Decho("manipulate directory listing (sort) : g:netrw_sort_by<".g:netrw_sort_by.">")
 
     if g:netrw_sort_by =~ "^n"
      " sort by name
      call s:NetrwSetSort()
 
-     if w:netrw_bannercnt < line("$")
+     if !g:netrw_banner || w:netrw_bannercnt < line("$")
 "      call Decho("g:netrw_sort_direction=".g:netrw_sort_direction." (bannercnt=".w:netrw_bannercnt.")")
       if g:netrw_sort_direction =~ 'n'
        " normal direction sorting
@@ -5844,11 +6260,11 @@
      endif
      " remove priority pattern prefix
 "     call Decho("remove priority pattern prefix")
-     let sepchr= "\<Char-0xff>"
-     exe 'silent keepjumps '.w:netrw_bannercnt.',$s/^\d\{3}'.sepchr.'//e'
+     exe 'silent keepjumps '.w:netrw_bannercnt.',$s/^\d\{3}'.g:netrw_sepchr.'//e'
+     call histdel("/",-1)
 
     elseif a:islocal
-     if w:netrw_bannercnt < line("$")
+     if !g:netrw_banner || w:netrw_bannercnt < line("$")
 "      call Decho("g:netrw_sort_direction=".g:netrw_sort_direction)
       if g:netrw_sort_direction =~ 'n'
 "       call Decho('exe silent keepjumps '.w:netrw_bannercnt.',$sort')
@@ -5857,13 +6273,17 @@
 "       call Decho('exe silent keepjumps '.w:netrw_bannercnt.',$sort!')
        exe 'silent keepjumps '.w:netrw_bannercnt.',$sort!'.' '.g:netrw_sort_options
       endif
-     endif
      exe 'silent keepjumps '.w:netrw_bannercnt.',$s/^\d\{-}\///e'
+     call histdel("/",-1)
+     endif
     endif
 
    elseif g:netrw_sort_direction =~ 'r'
 "    call Decho('reverse the sorted listing')
-    exe 'silent keepjumps '.w:netrw_bannercnt.'g/^/m '.w:netrw_bannercnt
+    if !g:netrw_banner || w:netrw_bannercnt < line('$')
+     exe 'silent keepjumps '.w:netrw_bannercnt.',$g/^/m '.w:netrw_bannercnt
+     call histdel("/",-1)
+    endif
    endif
   endif
 
@@ -5872,7 +6292,7 @@
   call s:NetrwWideListing()
   call s:NetrwTreeListing(b:netrw_curdir)
 
-  if exists("w:netrw_bannercnt") && line("$") > w:netrw_bannercnt
+  if exists("w:netrw_bannercnt") && (line("$") > w:netrw_bannercnt || !g:netrw_banner)
    " place cursor on the top-left corner of the file listing
 "   call Decho("place cursor on top-left corner of file listing")
    exe 'silent keepjumps '.w:netrw_bannercnt
@@ -6006,8 +6426,10 @@
     " cleanup
     if g:netrw_ftp_browse_reject != ""
      exe "silent! g/".g:netrw_ftp_browse_reject."/keepjumps d"
+     call histdel("/",-1)
     endif
     silent! keepjumps %s/\r$//e
+    call histdel("/",-1)
 
     " if there's no ../ listed, then put ./ and ../ in
     let line1= line(".")
@@ -6025,11 +6447,15 @@
     if search('^\d\{2}-\d\{2}-\d\{2}\s','n') " M$ ftp site cleanup
 "     call Decho("M$ ftp cleanup")
      exe 'silent! keepjumps '.w:netrw_bannercnt.',$s/^\d\{2}-\d\{2}-\d\{2}\s\+\d\+:\d\+[AaPp][Mm]\s\+\%(<DIR>\|\d\+\)\s\+//'
+     call histdel("/",-1)
     else " normal ftp cleanup
 "     call Decho("normal ftp cleanup")
      exe 'silent! keepjumps '.w:netrw_bannercnt.',$s/^\(\%(\S\+\s\+\)\{7}\S\+\)\s\+\(\S.*\)$/\2/e'
      exe "silent! keepjumps ".w:netrw_bannercnt.',$g/ -> /s# -> .*/$#/#e'
      exe "silent! keepjumps ".w:netrw_bannercnt.',$g/ -> /s# -> .*$#/#e'
+     call histdel("/",-1)
+     call histdel("/",-1)
+     call histdel("/",-1)
     endif
    endif
 
@@ -6045,8 +6471,12 @@
     g/^Listing directory/d
     g/^d[-rwx][-rwx][-rwx]/s+$+/+e
     silent g/^l[-rwx][-rwx][-rwx]/s+$+@+e
+    call histdel("/",-1)
+    call histdel("/",-1)
+    call histdel("/",-1)
     if g:netrw_liststyle != s:LONGLIST
      g/^[dlsp-][-rwx][-rwx][-rwx]/s/^.*\s\(\S\+\)$/\1/e
+     call histdel("/",-1)
     endif
    else
     if s:path == ""
@@ -6063,6 +6493,7 @@
    if g:netrw_ftp_browse_reject != ""
 "    call Decho("(cleanup) exe silent! g/".g:netrw_ssh_browse_reject."/keepjumps d")
     exe "silent! g/".g:netrw_ssh_browse_reject."/keepjumps d"
+    call histdel("/",-1)
    endif
   endif
 
@@ -6099,6 +6530,9 @@
     exe 'silent keepjumps '.w:netrw_bannercnt.',$s/ -> .*$//e'
     exe 'silent keepjumps '.w:netrw_bannercnt.',$s/^\(\%(\S\+\s\+\)\{7}\S\+\)\s\+\(\S.*\)$/\2\t\1/e'
     exe 'silent keepjumps '.w:netrw_bannercnt
+    call histdel("/",-1)
+    call histdel("/",-1)
+    call histdel("/",-1)
    endif
   endif
 
@@ -6118,6 +6552,7 @@
   let all= 0
   if exists("s:netrwmarkfilelist_{bufnr('%')}")
    " remove all marked files
+"   call Decho("remove all marked files with bufnr#".bufnr("%"))
    for fname in s:netrwmarkfilelist_{bufnr("%")}
     let ok= s:NetrwRemoteRmFile(a:path,fname,all)
     if ok =~ 'q\%[uit]'
@@ -6126,12 +6561,11 @@
      let all= 1
     endif
    endfor
-   unlet s:netrwmarkfilelist_{bufnr("%")}
-   unlet s:netrwmarkfilemtch_{bufnr("%")}
-   2match none
+   call s:NetrwUnmarkList(bufnr("%"),b:netrw_curdir)
 
   else
    " remove files specified by range
+"   call Decho("remove files specified by range")
 
    " preparation for removing multiple files/directories
    let ctr= a:firstline
@@ -6245,14 +6679,14 @@
      call s:NetrwRemoteFtpCmd(a:path,"rmdir ".a:rmfile)
     else
      let rmfile          = substitute(a:path.a:rmfile,'/$','','')
-     let netrw_rmdir_cmd = s:MakeSshCmd(s:WinPath(g:netrw_rmdir_cmd)).' '.shellescape(s:WinPath(rmfile))
+     let netrw_rmdir_cmd = s:MakeSshCmd(netrw#WinPath(g:netrw_rmdir_cmd)).' '.shellescape(netrw#WinPath(rmfile))
 "      call Decho("attempt to remove dir: system(".netrw_rmdir_cmd.")")
      let ret= system(netrw_rmdir_cmd)
 "      call Decho("returned=".ret." errcode=".v:shell_error)
 
      if v:shell_error != 0
 "      call Decho("v:shell_error not 0")
-      let netrw_rmf_cmd= s:MakeSshCmd(s:WinPath(g:netrw_rmf_cmd)).' '.shellescape(s:WinPath(substitute(rmfile,'[\/]$','','e')))
+      let netrw_rmf_cmd= s:MakeSshCmd(netrw#WinPath(g:netrw_rmf_cmd)).' '.shellescape(netrw#WinPath(substitute(rmfile,'[\/]$','','e')))
 "      call Decho("2nd attempt to remove dir: system(".netrw_rmf_cmd.")")
       let ret= system(netrw_rmf_cmd)
 "      call Decho("returned=".ret." errcode=".v:shell_error)
@@ -6353,13 +6787,17 @@
   " cleanup for Windows
   if has("win32") || has("win95") || has("win64") || has("win16")
    silent! keepjumps %s/\r$//e
+   call histdel("/",-1)
   endif
   if a:listcmd == "dir"
    " infer directory/link based on the file permission string
    silent! keepjumps g/d\%([-r][-w][-x]\)\{3}/s@$@/@
    silent! keepjumps g/l\%([-r][-w][-x]\)\{3}/s/$/@/
+   call histdel("/",-1)
+   call histdel("/",-1)
    if w:netrw_liststyle == s:THINLIST || w:netrw_liststyle == s:WIDELIST || w:netrw_liststyle == s:TREELIST
     exe "silent! keepjumps ".w:netrw_bannercnt.',$s/^\%(\S\+\s\+\)\{8}//e'
+    call histdel("/",-1)
    endif
   endif
 
@@ -6412,8 +6850,8 @@
     else
      let oldname= shellescape(a:path.oldname)
      let newname= shellescape(a:path.newname)
-"     call Decho("system(s:WinPath(".rename_cmd.") ".oldname.' '.newname.")")
-     let ret    = system(s:WinPath(rename_cmd).' '.oldname.' '.newname)
+"     call Decho("system(netrw#WinPath(".rename_cmd.") ".oldname.' '.newname.")")
+     let ret    = system(netrw#WinPath(rename_cmd).' '.oldname.' '.newname)
     endif
 
    endfor
@@ -6437,8 +6875,8 @@
     else
      let oldname= shellescape(a:path.oldname)
      let newname= shellescape(a:path.newname)
-"     call Decho("system(s:WinPath(".rename_cmd.") ".oldname.' '.newname.")")
-     let ret    = system(s:WinPath(rename_cmd).' '.oldname.' '.newname)
+"     call Decho("system(netrw#WinPath(".rename_cmd.") ".oldname.' '.newname.")")
+     let ret    = system(netrw#WinPath(rename_cmd).' '.oldname.' '.newname)
     endif
 
     let ctr= ctr + 1
@@ -6466,13 +6904,16 @@
   " The &ft == "netrw" test was installed because the BufEnter event
   " would hit when re-entering netrw windows, creating unexpected
   " refreshes (and would do so in the middle of NetrwSaveOptions(), too)
-"  call Decho("netrw#LocalBrowseCheck: isdir<".a:dirname.">=".isdirectory(a:dirname))
+"  call Decho("netrw#LocalBrowseCheck: isdir<".a:dirname.">=".isdirectory(a:dirname).((exists("s:treeforceredraw")? " treeforceredraw" : "")))
   if isdirectory(a:dirname)
 "   call Decho(" ft<".&ft."> b:netrw_curdir<".(exists("b:netrw_curdir")? b:netrw_curdir : " doesn't exist")."> dirname<".a:dirname.">"." line($)=".line("$"))
    if &ft != "netrw" || (exists("b:netrw_curdir") && b:netrw_curdir != a:dirname)
     silent! call s:NetrwBrowse(1,a:dirname)
    elseif &ft == "netrw" && line("$") == 1
     silent! call s:NetrwBrowse(1,a:dirname)
+   elseif exists("s:treeforceredraw")
+    unlet s:treeforceredraw
+    silent! call s:NetrwBrowse(1,a:dirname)
    endif
   endif
   " not a directory, ignore it
@@ -6492,7 +6933,7 @@
 
   " get the list of files contained in the current directory
   let dirname    = escape(b:netrw_curdir,g:netrw_glob_escape)
-  let dirnamelen = strlen(b:netrw_curdir)
+  let dirnamelen = s:Strlen(b:netrw_curdir)
   let filelist   = glob(s:ComposePath(dirname,"*"))
 "  call Decho("glob(dirname<".dirname."/*>)=".filelist)
   if filelist != ""
@@ -6608,7 +7049,7 @@
 
    if w:netrw_liststyle == s:LONGLIST
     let sz   = getfsize(filename)
-    let fsz  = strpart("               ",1,15-s:Strlen(sz)).sz
+    let fsz  = strpart("               ",1,15-strlen(sz)).sz
     let pfile= pfile."\t".fsz." ".strftime(g:netrw_timefmt,getftime(filename))
 "    call Decho("sz=".sz." fsz=".fsz)
    endif
@@ -6617,7 +7058,7 @@
     " sort by time (handles time up to 1 quintillion seconds, US)
 "    call Decho("getftime(".filename.")=".getftime(filename))
     let t  = getftime(filename)
-    let ft = strpart("000000000000000000",1,18-s:Strlen(t)).t
+    let ft = strpart("000000000000000000",1,18-strlen(t)).t
 "    call Decho("exe keepjumps put ='".ft.'/'.filename."'")
     let ftpfile= ft.'/'.pfile
     keepjumps silent! put=ftpfile
@@ -6626,7 +7067,7 @@
     " sort by size (handles file sizes up to 1 quintillion bytes, US)
 "    call Decho("getfsize(".filename.")=".getfsize(filename))
     let sz   = getfsize(filename)
-    let fsz  = strpart("000000000000000000",1,18-s:Strlen(sz)).sz
+    let fsz  = strpart("000000000000000000",1,18-strlen(sz)).sz
 "    call Decho("exe keepjumps put ='".fsz.'/'.filename."'")
     let fszpfile= fsz.'/'.pfile
     keepjumps silent! put =fszpfile
@@ -6639,7 +7080,9 @@
   endwhile
 
   " cleanup any windows mess at end-of-line
+  silent! keepjumps g/^$/d
   silent! keepjumps %s/\r$//e
+  call histdel("/",-1)
   exe "setlocal ts=".g:netrw_maxfilenamelen
 "  call Decho("setlocal ts=".g:netrw_maxfilenamelen)
 
@@ -6659,9 +7102,17 @@
    return
   endif
   if !exists("w:netrw_bannercnt")
-"   call Dret("LocalBrowseShellCmdRefresh : don't refresh when focus not on netrw windwo")
+"   call Dret("LocalBrowseShellCmdRefresh : don't refresh when focus not on netrw window")
    return
   endif
+  if exists("s:locbrowseshellcmd")
+   if s:locbrowseshellcmd
+    let s:locbrowseshellcmd= 0
+"    call Dret("LocalBrowseShellCmdRefresh : NetrwBrowse itself caused the refresh")
+    return
+   endif
+   let s:locbrowseshellcmd= 0
+  endif
   let itab       = 1
   let buftablist = []
   while itab <= tabpagenr("$")
@@ -6815,8 +7266,8 @@
    let rmfile= substitute(rmfile,'[\/]$','','e')
 
    if all || ok =~ 'y\%[es]' || ok == ""
-"    call Decho("1st attempt: system(s:WinPath(".g:netrw_local_rmdir.') '.shellescape(rmfile).')')
-    call system(s:WinPath(g:netrw_local_rmdir).' '.shellescape(rmfile))
+"    call Decho("1st attempt: system(netrw#WinPath(".g:netrw_local_rmdir.') '.shellescape(rmfile).')')
+    call system(netrw#WinPath(g:netrw_local_rmdir).' '.shellescape(rmfile))
 "    call Decho("v:shell_error=".v:shell_error)
 
     if v:shell_error != 0
@@ -6874,9 +7325,7 @@
     endif
     call rename(oldname,newname)
    endfor
-   2match none
-   unlet s:netrwmarkfilelist_{bufnr("%")}
-   unlet s:netrwmarkfilemtch_{bufnr("%")}
+   call s:NetrwUnmarkList(bufnr("%"),b:netrw_curdir)
   
   else
 
@@ -6955,9 +7404,11 @@
    augroup AuNetrwShellCmd
     au!
     if (has("win32") || has("win95") || has("win64") || has("win16"))
+"     call Decho("autocmd: ShellCmdPost * call s:LocalBrowseShellCmdRefresh()")
      au ShellCmdPost			*	call s:LocalBrowseShellCmdRefresh()
     else
      au ShellCmdPost,FocusGained	*	call s:LocalBrowseShellCmdRefresh()
+"     call Decho("autocmd: ShellCmdPost,FocusGained * call s:LocalBrowseShellCmdRefresh()")
     endif
    augroup END
   endif
@@ -6984,7 +7435,7 @@
 "   0=note     = s:NOTE
 "   1=warning  = s:WARNING
 "   2=error    = s:ERROR
-"  Jul 08, 2008 : max errnum currently is 71
+"  Dec 03, 2009 : max errnum currently is 76
 fun! netrw#ErrorMsg(level,msg,errnum)
 "  call Dfunc("netrw#ErrorMsg(level=".a:level." msg<".a:msg."> errnum=".a:errnum.") g:netrw_use_errorwindow=".g:netrw_use_errorwindow)
 
@@ -7017,7 +7468,8 @@
    else
 "    call Decho("create a NetrwMessage buffer window")
     bo 1split
-    enew
+    call s:NetrwEnew()
+    call s:NetrwSafeOptions()
     setlocal bt=nofile
     file NetrwMessage
 "    call Decho("setlocal ma noro")
@@ -7101,6 +7553,7 @@
   let w:netrw_winnr= winnr()
   let w:netrw_line = line(".")
   let w:netrw_col  = virtcol(".")
+"  call Decho("currently, win#".w:netrw_winnr." line#".w:netrw_line." col#".w:netrw_col)
 
   " Save top-of-screen line
   norm! H0
@@ -7130,7 +7583,7 @@
 
   if(has("amiga"))
 "   call Decho("amiga")
-   let ec = a:base[strlen(a:base)-1]
+   let ec = a:base[s:Strlen(a:base)-1]
    if ec != '/' && ec != ':'
     let ret = a:base . "/" . a:subdir
    else
@@ -7141,6 +7594,14 @@
 "   call Decho("windows")
    let ret= a:subdir
 
+  elseif a:base =~ '^\a:[/\\][^/\\]' && (has("win32") || has("win95") || has("win64") || has("win16"))
+"   call Decho("windows")
+   if a:base =~ '[/\\]$'
+    let ret= a:base.a:subdir
+   else
+    let ret= a:base."/".a:subdir
+   endif
+
   elseif a:base =~ '^\a\+://'
 "   call Decho("remote linux/macos")
    let urlbase = substitute(a:base,'^\(\a\+://.\{-}/\)\(.*\)$','\1','')
@@ -7212,7 +7673,7 @@
    endif
 
    " let netrw#NetSource() know about the tmpfile
-   let s:netrw_tmpfile= tmpfile " used by netrw#NetSource()
+   let s:netrw_tmpfile= tmpfile " used by netrw#NetSource() and netrw#NetrwBrowseX()
 "   call Decho("tmpfile<".tmpfile."> s:netrw_tmpfile<".s:netrw_tmpfile.">")
 
    " o/s dependencies
@@ -7301,7 +7762,7 @@
 fun! s:NetrwDelete(path)
 "  call Dfunc("s:NetrwDelete(path<".a:path.">)")
 
-  let path = s:WinPath(a:path)
+  let path = netrw#WinPath(a:path)
   if !g:netrw_cygwin && (has("win32") || has("win95") || has("win64") || has("win16"))
    if exists("+shellslash")
     let sskeep= &shellslash
@@ -7317,7 +7778,7 @@
    let result= delete(path)
   endif
   if result < 0
-   call Netrw#ErrorMsg(s:WARNING,"delete(".path.") failed!",71)
+   call netrw#ErrorMsg(s:WARNING,"delete(".path.") failed!",71)
   endif
 
 "  call Dret("s:NetrwDelete ".result)
@@ -7326,8 +7787,9 @@
 
 " ---------------------------------------------------------------------
 " s:NetrwEnew: opens a new buffer, passes netrw buffer variables through {{{2
-fun! s:NetrwEnew(curdir)
-"  call Dfunc("s:NetrwEnew(curdir<".a:curdir.">) buf#".bufnr("%")."<".bufname("%").">")
+fun! s:NetrwEnew(...)
+"  call Dfunc("s:NetrwEnew() a:0=".a:0)
+"  call Decho("curdir<".((a:0>0)? a:1 : "")."> buf#".bufnr("%")."<".bufname("%").">")
 
   " grab a function-local-variable copy of buffer variables
   if exists("b:netrw_bannercnt")      |let netrw_bannercnt       = b:netrw_bannercnt      |endif
@@ -7370,14 +7832,16 @@
   if exists("netrw_option")         |let b:netrw_option          = netrw_option         |endif
   if exists("netrw_prvdir")         |let b:netrw_prvdir          = netrw_prvdir         |endif
 
-  let b:netrw_curdir= a:curdir
-  if b:netrw_curdir =~ '/$'
-   if exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST
-    file NetrwTreeListing
-    nno <silent> <buffer> [	:silent call <SID>TreeListMove('[')<cr>
-    nno <silent> <buffer> ]	:silent call <SID>TreeListMove(']')<cr>
-   else
-    exe "silent! keepalt file ".fnameescape(b:netrw_curdir)
+  if a:0 > 0
+   let b:netrw_curdir= a:1
+   if b:netrw_curdir =~ '/$'
+    if exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST
+     file NetrwTreeListing
+     nno <silent> <buffer> [	:silent call <SID>TreeListMove('[')<cr>
+     nno <silent> <buffer> ]	:silent call <SID>TreeListMove(']')<cr>
+    else
+     exe "silent! keepalt file ".fnameescape(b:netrw_curdir)
+    endif
    endif
   endif
 
@@ -7511,13 +7975,16 @@
    call netrw#NetrwRestorePosn(s:nbcd_curpos_{bufnr('%')})
    unlet s:nbcd_curpos_{bufnr('%')}
   endif
+  if exists("s:explore_match")
+   exe "2match netrwMarkFile /".s:explore_match."/"
+  endif
 "  call Dret("s:NetrwRexplore")
 endfun
 
 " ---------------------------------------------------------------------
 " s:SaveBufVars: {{{2
 fun! s:SaveBufVars()
-"  call Dfunc("s:SaveBufVars()")
+"  call Dfunc("s:SaveBufVars() buf#".bufnr("%"))
 
   if exists("b:netrw_curdir")        |let s:netrw_curdir         = b:netrw_curdir        |endif
   if exists("b:netrw_lastfile")      |let s:netrw_lastfile       = b:netrw_lastfile      |endif
@@ -7532,7 +7999,7 @@
 " ---------------------------------------------------------------------
 " s:SaveWinVars: (used by Explore() and NetrwSplit()) {{{2
 fun! s:SaveWinVars()
-"  call Dfunc("s:SaveWinVars()")
+"  call Dfunc("s:SaveWinVars() win#".winnr())
   if exists("w:netrw_bannercnt")      |let s:bannercnt       = w:netrw_bannercnt      |endif
   if exists("w:netrw_col")            |let s:col             = w:netrw_col            |endif
   if exists("w:netrw_curdir")         |let s:curdir          = w:netrw_curdir         |endif
@@ -7562,7 +8029,7 @@
 "   variables are not inherited by the new window.  SetBufWinVars() and
 "   UseBufWinVars() get around that.
 fun! s:SetBufWinVars()
-"  call Dfunc("s:SetBufWinVars()")
+"  call Dfunc("s:SetBufWinVars() win#".winnr())
   if exists("w:netrw_liststyle")      |let b:netrw_liststyle      = w:netrw_liststyle      |endif
   if exists("w:netrw_bannercnt")      |let b:netrw_bannercnt      = w:netrw_bannercnt      |endif
   if exists("w:netrw_method")         |let b:netrw_method         = w:netrw_method         |endif
@@ -7584,8 +8051,7 @@
   if a:islocal
    exe 'com! Rexplore call s:NetrwRexplore(1,"'.escape(a:dirname,'"\').'")'
    if g:netrw_retmap
-    silent! unmap <2-leftmouse>
-    if !hasmapto("<Plug>NetrwReturn")
+    if !hasmapto("<Plug>NetrwReturn") && maparg("<2-leftmouse>","n") == ""
      nmap <unique> <silent> <2-leftmouse>	<Plug>NetrwReturn
     endif
     let dir = escape(a:dirname, s:netrw_map_escape)
@@ -7594,8 +8060,7 @@
   else
    exe 'com! Rexplore call s:NetrwRexplore(0,"'.escape(a:dirname,'"\').'")'
    if g:netrw_retmap
-    silent! unmap <2-leftmouse>
-    if !hasmapto("<Plug>NetrwReturn")
+    if !hasmapto("<Plug>NetrwReturn") && maparg("<2-leftmouse>","n") == ""
      nmap <unique> <silent> <2-leftmouse>	<Plug>NetrwReturn
     endif
     let dir = escape(a:dirname, s:netrw_map_escape)
@@ -7608,9 +8073,9 @@
 " ---------------------------------------------------------------------
 " s:Strlen: this function returns the length of a string, even if its {{{2
 "           using two-byte etc characters.
-"           Currently, its only used if g:Align_xstrlen is set to a
-"           nonzero value.  Solution from Nicolai Weibull, vim docs
-"           (:help strlen()), Tony Mechelynck, and my own invention.
+"           Solution from Nicolai Weibull, vim docs (:help strlen()), Tony Mechelynck,
+"           and a bit from me.
+"           if g:netrw_xstrlen is zero (default), then the builtin strlen() function is used.
 fun! s:Strlen(x)
 "  call Dfunc("s:Strlen(x<".a:x.">")
   if g:netrw_xstrlen == 1
@@ -7638,7 +8103,7 @@
 
   else
    " at least give a decent default
-   ret= strlen(a:x)
+   let ret= strlen(a:x)
   endif
 "  call Dret("s:Strlen ".ret)
   return ret
@@ -7707,7 +8172,7 @@
 "                      Buffers.Refresh; hence, s:NetrwBMShow() utilizes a "cheat" to call that function anyway.
 fun! s:UpdateBuffersMenu()
 "  call Dfunc("s:UpdateBuffersMenu()")
-  if has("gui") && has("menu") && has("gui_running") && &go =~ 'm'
+  if has("gui") && has("menu") && has("gui_running") && &go =~ 'm' && g:netrw_menu
    try
     silent emenu Buffers.Refresh\ menu
    catch /^Vim\%((\a\+)\)\=:E/
@@ -7737,12 +8202,14 @@
 endfun
 
 " ---------------------------------------------------------------------
-" s:WinPath: {{{2
-fun! s:WinPath(path)
-"  call Dfunc("s:WinPath(path<".a:path.">)")
-  if !g:netrw_cygwin && (has("win32") || has("win95") || has("win64") || has("win16"))
+" netrw#WinPath: tries to insure that the path is windows-acceptable, whether cygwin is used or not {{{2
+fun! netrw#WinPath(path)
+"  call Dfunc("netrw#WinPath(path<".a:path.">)")
+  if (!g:netrw_cygwin || &shell !~ '\%(\<bash\>\|\<zsh\>\)\%(\.exe\)\=$') && (has("win32") || has("win95") || has("win64") || has("win16"))
+   " remove cygdrive prefix, if present
+   let path = substitute(a:path,'/cygdrive/\(.\)','\1:','')
    " remove trailing slash (Win95)
-   let path = substitute(a:path, '\(\\\|/\)$', '', 'g')
+   let path = substitute(path, '\(\\\|/\)$', '', 'g')
    " remove escaped spaces
    let path = substitute(path, '\ ', ' ', 'g')
    " convert slashes to backslashes
@@ -7750,7 +8217,7 @@
   else
    let path= a:path
   endif
-"  call Dret("s:WinPath <".path.">")
+"  call Dret("netrw#WinPath <".path.">")
   return path
 endfun
 
diff --git a/runtime/autoload/netrwFileHandlers.vim b/runtime/autoload/netrwFileHandlers.vim
index 5fb05ba..1515b00 100644
--- a/runtime/autoload/netrwFileHandlers.vim
+++ b/runtime/autoload/netrwFileHandlers.vim
@@ -1,9 +1,9 @@
 " netrwFileHandlers: contains various extension-based file handlers for
 "                    netrw's browsers' x command ("eXecute launcher")
 " Author:	Charles E. Campbell, Jr.
-" Date:		May 30, 2006
-" Version:	9
-" Copyright:    Copyright (C) 1999-2005 Charles E. Campbell, Jr. {{{1
+" Date:		Sep 30, 2008
+" Version:	10
+" Copyright:    Copyright (C) 1999-2008 Charles E. Campbell, Jr. {{{1
 "               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,
@@ -20,9 +20,15 @@
 if exists("g:loaded_netrwFileHandlers") || &cp
  finish
 endif
+let g:loaded_netrwFileHandlers= "v10"
+if v:version < 702
+ echohl WarningMsg
+ echo "***warning*** this version of netrwFileHandlers needs vim 7.2"
+ echohl Normal
+ finish
+endif
 let s:keepcpo= &cpo
 set cpo&vim
-let g:loaded_netrwFileHandlers= "v9"
 
 " ---------------------------------------------------------------------
 " netrwFileHandlers#Invoke: {{{1
@@ -73,10 +79,10 @@
 
   if executable("mozilla")
 "   call Decho("executing !mozilla ".page)
-   exe "!mozilla ".g:netrw_shq.page.g:netrw_shq
+   exe "!mozilla ".shellescape(page,1)
   elseif executable("netscape")
 "   call Decho("executing !netscape ".page)
-   exe "!netscape ".g:netrw_shq..page.g:netrw_shq
+   exe "!netscape ".shellescape(page,1)
   else
 "   call Dret("s:NFH_html 0")
    return 0
@@ -96,10 +102,10 @@
 
   if executable("mozilla")
 "   call Decho("executing !mozilla ".page)
-   exe "!mozilla ".g:netrw_shq.page.g:netrw_shq
+   exe "!mozilla ".shellescape(page,1)
   elseif executable("netscape")
 "   call Decho("executing !netscape ".page)
-   exe "!netscape ".g:netrw_shq.page.g:netrw_shq
+   exe "!netscape ".shellescape(page,1)
   else
 "   call Dret("s:NFH_htm 0")
    return 0
@@ -115,10 +121,10 @@
 "  call Dfunc("s:NFH_jpg(jpgfile<".a:jpgfile.">)")
 
   if executable("gimp")
-   exe "silent! !gimp -s ".g:netrw_shq.a:jpgfile.g:netrw_shq
+   exe "silent! !gimp -s ".shellescape(a:jpgfile,1)
   elseif executable(expand("$SystemRoot")."/SYSTEM32/MSPAINT.EXE")
 "   call Decho("silent! !".expand("$SystemRoot")."/SYSTEM32/MSPAINT ".escape(a:jpgfile," []|'"))
-   exe "!".expand("$SystemRoot")."/SYSTEM32/MSPAINT ".g:netrw_shq.a:jpgfile.g:netrw_shq
+   exe "!".expand("$SystemRoot")."/SYSTEM32/MSPAINT ".shellescape(a:jpgfile,1)
   else
 "   call Dret("s:NFH_jpg 0")
    return 0
@@ -134,9 +140,9 @@
 "  call Dfunc("s:NFH_gif(giffile<".a:giffile.">)")
 
   if executable("gimp")
-   exe "silent! !gimp -s ".g:netrw_shq.a:giffile.g:netrw_shq
+   exe "silent! !gimp -s ".shellescape(a:giffile,1)
   elseif executable(expand("$SystemRoot")."/SYSTEM32/MSPAINT.EXE")
-   exe "silent! !".expand("$SystemRoot")."/SYSTEM32/MSPAINT ".g:netrw_shq.a:giffile.g:netrw_shq
+   exe "silent! !".expand("$SystemRoot")."/SYSTEM32/MSPAINT ".shellescape(a:giffile,1)
   else
 "   call Dret("s:NFH_gif 0")
    return 0
@@ -152,9 +158,9 @@
 "  call Dfunc("s:NFH_png(pngfile<".a:pngfile.">)")
 
   if executable("gimp")
-   exe "silent! !gimp -s ".g:netrw_shq.a:pngfile.g:netrw_shq
+   exe "silent! !gimp -s ".shellescape(a:pngfile,1)
   elseif executable(expand("$SystemRoot")."/SYSTEM32/MSPAINT.EXE")
-   exe "silent! !".expand("$SystemRoot")."/SYSTEM32/MSPAINT ".g:netrw_shq.a:pngfile.g:netrw_shq
+   exe "silent! !".expand("$SystemRoot")."/SYSTEM32/MSPAINT ".shellescape(a:pngfile,1)
   else
 "   call Dret("s:NFH_png 0")
    return 0
@@ -170,9 +176,9 @@
 "  call Dfunc("s:NFH_pnm(pnmfile<".a:pnmfile.">)")
 
   if executable("gimp")
-   exe "silent! !gimp -s ".g:netrw_shq.a:pnmfile.g:netrw_shq
+   exe "silent! !gimp -s ".shellescape(a:pnmfile,1)
   elseif executable(expand("$SystemRoot")."/SYSTEM32/MSPAINT.EXE")
-   exe "silent! !".expand("$SystemRoot")."/SYSTEM32/MSPAINT ".g:netrw_shq.a:pnmfile.g:netrw_shq
+   exe "silent! !".expand("$SystemRoot")."/SYSTEM32/MSPAINT ".shellescape(a:pnmfile,1)
   else
 "   call Dret("s:NFH_pnm 0")
    return 0
@@ -190,7 +196,7 @@
   if executable("gimp")
    exe "silent! !gimp -s ".a:bmpfile
   elseif executable(expand("$SystemRoot")."/SYSTEM32/MSPAINT.EXE")
-   exe "silent! !".expand("$SystemRoot")."/SYSTEM32/MSPAINT ".g:netrw_shq.a:bmpfile.g:netrw_shq
+   exe "silent! !".expand("$SystemRoot")."/SYSTEM32/MSPAINT ".shellescape(a:bmpfile,1)
   else
 "   call Dret("s:NFH_bmp 0")
    return 0
@@ -205,9 +211,9 @@
 fun! s:NFH_pdf(pdf)
 "  call Dfunc("s:NFH_pdf(pdf<".a:pdf.">)")
   if executable("gs")
-   exe 'silent! !gs '.g:netrw_shq.a:pdf.g:netrw_shq
+   exe 'silent! !gs '.shellescape(a:pdf,1)
   elseif executable("pdftotext")
-   exe 'silent! pdftotext -nopgbrk '.g:netrw_shq.a:pdf.g:netrw_shq
+   exe 'silent! pdftotext -nopgbrk '.shellescape(a:pdf,1)
   else
 "  call Dret("s:NFH_pdf 0")
    return 0
@@ -223,7 +229,7 @@
 "  call Dfunc("s:NFH_doc(doc<".a:doc.">)")
 
   if executable("oowriter")
-   exe 'silent! !oowriter '.g:netrw_shq.a:doc.g:netrw_shq
+   exe 'silent! !oowriter '.shellescape(a:doc,1)
    redraw!
   else
 "  call Dret("s:NFH_doc 0")
@@ -240,7 +246,7 @@
 "  call Dfunc("s:NFH_sxw(sxw<".a:sxw.">)")
 
   if executable("oowriter")
-   exe 'silent! !oowriter '.g:netrw_shq.a:sxw.g:netrw_shq
+   exe 'silent! !oowriter '.shellescape(a:sxw,1)
    redraw!
   else
 "   call Dret("s:NFH_sxw 0")
@@ -257,7 +263,7 @@
 "  call Dfunc("s:NFH_xls(xls<".a:xls.">)")
 
   if executable("oocalc")
-   exe 'silent! !oocalc '.g:netrw_shq.a:xls.g:netrw_shq
+   exe 'silent! !oocalc '.shellescape(a:xls,1)
    redraw!
   else
 "  call Dret("s:NFH_xls 0")
@@ -274,15 +280,15 @@
 "  call Dfunc("s:NFH_ps(ps<".a:ps.">)")
   if executable("gs")
 "   call Decho("exe silent! !gs ".a:ps)
-   exe "silent! !gs ".g:netrw_shq.a:ps.g:netrw_shq
+   exe "silent! !gs ".shellescape(a:ps,1)
    redraw!
   elseif executable("ghostscript")
 "   call Decho("exe silent! !ghostscript ".a:ps)
-   exe "silent! !ghostscript ".g:netrw_shq.a:ps.g:netrw_shq
+   exe "silent! !ghostscript ".shellescape(a:ps,1)
    redraw!
   elseif executable("gswin32")
-"   call Decho("exe silent! !gswin32 ".g:netrw_shq.a:ps.g:netrw_shq)
-   exe "silent! !gswin32 ".g:netrw_shq.a:ps.g:netrw_shq
+"   call Decho("exe silent! !gswin32 ".shellescape(a:ps,1))
+   exe "silent! !gswin32 ".shellescape(a:ps,1)
    redraw!
   else
 "   call Dret("s:NFH_ps 0")
@@ -298,16 +304,16 @@
 fun! s:NFH_eps(eps)
 "  call Dfunc("s:NFH_eps()")
   if executable("gs")
-   exe "silent! !gs ".g:netrw_shq.a:eps.g:netrw_shq
+   exe "silent! !gs ".shellescape(a:eps,1)
    redraw!
   elseif executable("ghostscript")
-   exe "silent! !ghostscript ".g:netrw_shq.a:eps.g:netrw_shq
+   exe "silent! !ghostscript ".shellescape(a:eps,1)
    redraw!
   elseif executable("ghostscript")
-   exe "silent! !ghostscript ".g:netrw_shq.a:eps.g:netrw_shq
+   exe "silent! !ghostscript ".shellescape(a:eps,1)
    redraw!
   elseif executable("gswin32")
-   exe "silent! !gswin32 ".g:netrw_shq.a:eps.g:netrw_shq
+   exe "silent! !gswin32 ".shellescape(a:eps,1)
    redraw!
   else
 "   call Dret("s:NFH_eps 0")
diff --git a/runtime/autoload/netrwSettings.vim b/runtime/autoload/netrwSettings.vim
index c0704d4..38f7299 100644
--- a/runtime/autoload/netrwSettings.vim
+++ b/runtime/autoload/netrwSettings.vim
@@ -1,7 +1,7 @@
 " netrwSettings.vim: makes netrw settings simpler
-" Date:		Jul 02, 2008
+" Date:		Sep 03, 2008
 " Maintainer:	Charles E Campbell, Jr <drchipNOSPAM at campbellfamily dot biz>
-" Version:	12
+" Version:	13
 " Copyright:    Copyright (C) 1999-2007 Charles E. Campbell, Jr. {{{1
 "               Permission is hereby granted to use and distribute this code,
 "               with or without modifications, provided that this copyright
@@ -19,7 +19,13 @@
 if exists("g:loaded_netrwSettings") || &cp
   finish
 endif
-let g:loaded_netrwSettings  = "v12"
+let g:loaded_netrwSettings = "v13"
+if v:version < 700
+ echohl WarningMsg
+ echo "***warning*** this version of netrwSettings needs vim 7.0"
+ echohl Normal
+ finish
+endif
 
 " ---------------------------------------------------------------------
 " NetrwSettings: {{{1
@@ -100,6 +106,7 @@
    put = 'let g:netrw_browsex_viewer    = (not defined)'
   endif
   put = 'let g:netrw_compress          = '.g:netrw_compress
+  put = 'let g:netrw_cursorline        = '.g:netrw_cursorline
   let decompressline= line("$")
   put ='let g:netrw_decompress...'
   put = 'let g:netrw_dirhistmax        = '.g:netrw_dirhistmax
@@ -138,6 +145,7 @@
   put = 'let g:netrw_special_syntax    = '.g:netrw_special_syntax
   put = 'let g:netrw_ssh_browse_reject = '.g:netrw_ssh_browse_reject
   put = 'let g:netrw_scpport           = '.g:netrw_scpport
+  put = 'let g:netrw_sepchr            = '.g:netrw_sepchr
   put = 'let g:netrw_sshport           = '.g:netrw_sshport
   put = 'let g:netrw_timefmt           = '.g:netrw_timefmt
   let tmpfileescline= line("$")
diff --git a/runtime/autoload/rubycomplete.vim b/runtime/autoload/rubycomplete.vim
index 87e6c9a..86baa0d 100644
--- a/runtime/autoload/rubycomplete.vim
+++ b/runtime/autoload/rubycomplete.vim
@@ -1,7 +1,7 @@
 " Vim completion script
 " Language:             Ruby
 " Maintainer:           Mark Guzman <segfault@hasno.info>
-" Info:                 $Id$
+" Info:                 $Id: rubycomplete.vim,v 1.41 2008/06/30 06:50:45 segy Exp $
 " URL:                  http://vim-ruby.rubyforge.org
 " Anon CVS:             See above site
 " Release Coordinator:  Doug Kearns <dougkearns@gmail.com>
diff --git a/runtime/autoload/spellfile.vim b/runtime/autoload/spellfile.vim
index 9979f1b..534acc6 100644
--- a/runtime/autoload/spellfile.vim
+++ b/runtime/autoload/spellfile.vim
@@ -1,6 +1,6 @@
 " Vim script to download a missing spell file
 " Maintainer:	Bram Moolenaar <Bram@vim.org>
-" Last Change:	2008 Jun 27
+" Last Change:	2008 Nov 29
 
 if !exists('g:spellfile_URL')
   " Prefer using http:// when netrw should be able to use it, since
@@ -39,19 +39,22 @@
   let s:donedict[a:lang . &enc] = 1
 
   " Find spell directories we can write in.
-  let dirlist = []
-  let dirchoices = '&Cancel'
-  for dir in split(globpath(&rtp, 'spell'), "\n")
-    if filewritable(dir) == 2
-      call add(dirlist, dir)
-      let dirchoices .= "\n&" . len(dirlist)
-    endif
-  endfor
+  let [dirlist, dirchoices] = spellfile#GetDirChoices()
   if len(dirlist) == 0
-    if &verbose
+    let dir_to_create = spellfile#WritableSpellDir()
+    if &verbose || dir_to_create != ''
       echomsg 'spellfile#LoadFile(): There is no writable spell directory.'
     endif
-    return
+    if dir_to_create != ''
+      if confirm("Shall I create " . dir_to_create, "&Yes\n&No", 2) == 1
+	" After creating the directory it should show up in the list.
+	call mkdir(dir_to_create, "p")
+	let [dirlist, dirchoices] = spellfile#GetDirChoices()
+      endif
+    endif
+    if len(dirlist) == 0
+      return
+    endif
   endif
 
   let msg = 'Cannot find spell file for "' . a:lang . '" in ' . &enc
@@ -177,3 +180,29 @@
     unlet g:netrw_use_errorwindow
   endif
 endfunc
+
+" Get a list of writable spell directories and choices for confirm().
+function! spellfile#GetDirChoices()
+  let dirlist = []
+  let dirchoices = '&Cancel'
+  for dir in split(globpath(&rtp, 'spell'), "\n")
+    if filewritable(dir) == 2
+      call add(dirlist, dir)
+      let dirchoices .= "\n&" . len(dirlist)
+    endif
+  endfor
+  return [dirlist, dirchoices]
+endfunc
+
+function! spellfile#WritableSpellDir()
+  if has("unix")
+    " For Unix always use the $HOME/.vim directory
+    return $HOME . "/.vim/spell"
+  endif
+  for dir in split(&rtp, ',')
+    if filewritable(dir) == 2
+      return dir . "/spell"
+    endif
+  endfor
+  return ''
+endfunction
diff --git a/runtime/autoload/sqlcomplete.vim b/runtime/autoload/sqlcomplete.vim
index eecb326..aae92e6 100644
--- a/runtime/autoload/sqlcomplete.vim
+++ b/runtime/autoload/sqlcomplete.vim
@@ -1,13 +1,19 @@
 " Vim OMNI completion script for SQL
 " Language:    SQL
-" Maintainer:  David Fishburn <fishburn@ianywhere.com>
-" Version:     6.0
-" Last Change: Thu 03 Apr 2008 10:37:54 PM Eastern Daylight Time
+" Maintainer:  David Fishburn <dfishburn dot vim at gmail dot com>
+" Version:     7.0
+" Last Change: 2009 Jan 04
 " Usage:       For detailed help
 "              ":help sql.txt" 
 "              or ":help ft-sql-omni" 
 "              or read $VIMRUNTIME/doc/sql.txt
 
+" History
+" Version 7.0
+"     Better handling of object names
+" Version 6.0
+"     Supports object names with spaces "my table name"
+"
 " Set completion with CTRL-X CTRL-O to autoloaded function.
 " This check is in place in case this script is
 " sourced directly instead of using the autoload feature. 
@@ -22,7 +28,7 @@
 if exists('g:loaded_sql_completion')
     finish 
 endif
-let g:loaded_sql_completion = 50
+let g:loaded_sql_completion = 70
 
 " Maintains filename of dictionary
 let s:sql_file_table        = ""
@@ -106,10 +112,23 @@
             let begindot = 1
         endif
         while start > 0
-            if line[start - 1] =~ '\(\w\|\s\+\)'
+            " Additional code was required to handle objects which 
+            " can contain spaces like "my table name".
+            if line[start - 1] !~ '\(\w\|\.\)'
+                " If the previous character is not a period or word character
+                break
+            " elseif line[start - 1] =~ '\(\w\|\s\+\)'
+            "     let start -= 1
+            elseif line[start - 1] =~ '\w'
+                " If the previous character is word character continue back
                 let start -= 1
             elseif line[start - 1] =~ '\.' && 
                         \ compl_type =~ 'column\|table\|view\|procedure'
+                " If the previous character is a period and we are completing
+                " an object which can be specified with a period like this:
+                "     table_name.column_name
+                "     owner_name.table_name
+
                 " If lastword has already been set for column completion
                 " break from the loop, since we do not also want to pickup
                 " a table name if it was also supplied.
@@ -184,9 +203,10 @@
         endif
 
         let compl_type_uc = substitute(compl_type, '\w\+', '\u&', '')
-        if s:sql_file_{compl_type} == ""
-            let s:sql_file_{compl_type} = DB_getDictionaryName(compl_type_uc)
-        endif
+        " Same call below, no need to do it twice
+        " if s:sql_file_{compl_type} == ""
+        "     let s:sql_file_{compl_type} = DB_getDictionaryName(compl_type_uc)
+        " endif
         let s:sql_file_{compl_type} = DB_getDictionaryName(compl_type_uc)
         if s:sql_file_{compl_type} != ""
             if filereadable(s:sql_file_{compl_type})
@@ -312,9 +332,16 @@
     endif
 
     if base != ''
-        " Filter the list based on the first few characters the user
-        " entered
-        let expr = 'v:val '.(g:omni_sql_ignorecase==1?'=~?':'=~#').' "\\(^'.base.'\\|\\([^.]*\\)\\?'.base.'\\)"'
+        " Filter the list based on the first few characters the user entered.
+        " Check if the text matches at the beginning 
+        " or 
+        " Match to a owner.table or alias.column type match
+        " or
+        " Handle names with spaces "my table name"
+        let expr = 'v:val '.(g:omni_sql_ignorecase==1?'=~?':'=~#').' "\\(^'.base.'\\|^\\(\\w\\+\\.\\)\\?'.base.'\\)"'
+        " let expr = 'v:val '.(g:omni_sql_ignorecase==1?'=~?':'=~#').' "\\(^'.base.'\\)"'
+        " let expr = 'v:val '.(g:omni_sql_ignorecase==1?'=~?':'=~#').' "\\(^'.base.'\\|\\(\\.\\)\\?'.base.'\\)"'
+        " let expr = 'v:val '.(g:omni_sql_ignorecase==1?'=~?':'=~#').' "\\(^'.base.'\\|\\([^.]*\\)\\?'.base.'\\)"'
         let compl_list = filter(deepcopy(compl_list), expr)
     endif
 
diff --git a/runtime/autoload/tar.vim b/runtime/autoload/tar.vim
index af6fbca..3e44579 100644
--- a/runtime/autoload/tar.vim
+++ b/runtime/autoload/tar.vim
@@ -1,13 +1,13 @@
 " tar.vim: Handles browsing tarfiles
 "            AUTOLOAD PORTION
-" Date:			Aug 08, 2008
-" Version:		23 + modifications by Bram
+" Date:			Dec 28, 2009
+" Version:		24
 " Maintainer:	Charles E Campbell, Jr <NdrOchip@ScampbellPfamily.AbizM-NOSPAM>
 " License:		Vim License  (see vim's :help license)
 "
 "	Contains many ideas from Michael Toren's <tar.vim>
 "
-" Copyright:    Copyright (C) 2005-2008 Charles E. Campbell, Jr. {{{1
+" Copyright:    Copyright (C) 2005-2009 Charles E. Campbell, Jr. {{{1
 "               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,
@@ -16,19 +16,22 @@
 "               By using this plugin, you agree that in no event will the
 "               copyright holder be liable for any damages resulting from
 "               the use of this software.
-
+"     call inputsave()|call input("Press <cr> to continue")|call inputrestore()
 " ---------------------------------------------------------------------
 " Load Once: {{{1
-let s:keepcpo= &cpo
-set cpo&vim
-if &cp || exists("g:loaded_tar") || v:version < 700
+if &cp || exists("g:loaded_tar")
  finish
 endif
-let g:loaded_tar= "v23b"
-"call Decho("loading autoload/tar.vim")
-if v:version < 701 || (v:version == 701 && !has("patch299"))
- echoerr "(autoload/tar.vim) need vim v7.1 with patchlevel 299"
+let g:loaded_tar= "v24"
+if v:version < 702
+ echohl WarningMsg
+ echo "***warning*** this version of tar needs vim 7.2"
+ echohl Normal
+ finish
 endif
+let s:keepcpo= &cpo
+set cpo&vim
+"call Decho("loading autoload/tar.vim")
 
 " ---------------------------------------------------------------------
 "  Default Settings: {{{1
@@ -44,7 +47,22 @@
 if !exists("g:tar_writeoptions")
  let g:tar_writeoptions= "uf"
 endif
-
+if !exists("g:tar_copycmd")
+ if !exists("g:netrw_localcopycmd")
+  if has("win32") || has("win95") || has("win64") || has("win16")
+   if g:netrw_cygwin
+    let g:netrw_localcopycmd= "cp"
+   else
+    let g:netrw_localcopycmd= "copy"
+   endif
+  elseif has("unix") || has("macunix")
+   let g:netrw_localcopycmd= "cp"
+  else
+   let g:netrw_localcopycmd= ""
+  endif
+ endif
+ let g:tar_copycmd= g:netrw_localcopycmd
+endif
 if !exists("g:netrw_cygwin")
  if has("win32") || has("win95") || has("win64") || has("win16")
   if &shell =~ '\%(\<bash\>\|\<zsh\>\)\%(\.exe\)\=$'
@@ -56,6 +74,9 @@
   let g:netrw_cygwin= 0
  endif
 endif
+if !exists("g:tar_extractcmd")
+ let g:tar_extractcmd= "tar -xf"
+endif
 
 " set up shell quoting character
 if !exists("g:tar_shq")
@@ -88,7 +109,6 @@
   if !executable(g:tar_cmd)
    redraw!
    echohl Error | echo '***error*** (tar#Browse) "'.g:tar_cmd.'" not available on your system'
-"   call inputsave()|call input("Press <cr> to continue")|call inputrestore()
    let &report= repkeep
 "   call Dret("tar#Browse")
    return
@@ -99,7 +119,6 @@
     " if its an url, don't complain, let url-handlers such as vim do its thing
     redraw!
     echohl Error | echo "***error*** (tar#Browse) File not readable<".a:tarfile.">" | echohl None
-"    call inputsave()|call input("Press <cr> to continue")|call inputrestore()
    endif
    let &report= repkeep
 "   call Dret("tar#Browse : file<".a:tarfile."> not readable")
@@ -130,37 +149,38 @@
   let tarfile= a:tarfile
   if has("win32") && executable("cygpath")
    " assuming cygwin
-   let tarfile=substitute(system("cygpath -u ".s:Escape(tarfile,0)),'\n$','','e')
+   let tarfile=substitute(system("cygpath -u ".shellescape(tarfile,0)),'\n$','','e')
   endif
   let curlast= line("$")
   if tarfile =~# '\.\(gz\|tgz\)$'
-"   call Decho("1: exe silent r! gzip -d -c -- ".s:Escape(tarfile,1)." | ".g:tar_cmd." -".g:tar_browseoptions." - ")
-   exe "silent r! gzip -d -c -- ".s:Escape(tarfile,1)." | ".g:tar_cmd." -".g:tar_browseoptions." - "
+"   call Decho("1: exe silent r! gzip -d -c -- ".shellescape(tarfile,1)." | ".g:tar_cmd." -".g:tar_browseoptions." - ")
+   exe "silent r! gzip -d -c -- ".shellescape(tarfile,1)." | ".g:tar_cmd." -".g:tar_browseoptions." - "
   elseif tarfile =~# '\.lrp'
-"   call Decho("2: exe silent r! cat -- ".s:Escape(tarfile,1)."|gzip -d -c -|".g:tar_cmd." -".g:tar_browseoptions." - ")
-   exe "silent r! cat -- ".s:Escape(tarfile,1)."|gzip -d -c -|".g:tar_cmd." -".g:tar_browseoptions." - "
+"   call Decho("2: exe silent r! cat -- ".shellescape(tarfile,1)."|gzip -d -c -|".g:tar_cmd." -".g:tar_browseoptions." - ")
+   exe "silent r! cat -- ".shellescape(tarfile,1)."|gzip -d -c -|".g:tar_cmd." -".g:tar_browseoptions." - "
   elseif tarfile =~# '\.bz2$'
-"   call Decho("3: exe silent r! bzip2 -d -c -- ".s:Escape(tarfile,1)." | ".g:tar_cmd." -".g:tar_browseoptions." - ")
-   exe "silent r! bzip2 -d -c -- ".s:Escape(tarfile,1)." | ".g:tar_cmd." -".g:tar_browseoptions." - "
+"   call Decho("3: exe silent r! bzip2 -d -c -- ".shellescape(tarfile,1)." | ".g:tar_cmd." -".g:tar_browseoptions." - ")
+   exe "silent r! bzip2 -d -c -- ".shellescape(tarfile,1)." | ".g:tar_cmd." -".g:tar_browseoptions." - "
+  elseif tarfile =~# '\.lzma$'
+"   call Decho("3: exe silent r! lzma -d -c -- ".shellescape(tarfile,1)." | ".g:tar_cmd." -".g:tar_browseoptions." - ")
+   exe "silent r! lzma -d -c -- ".shellescape(tarfile,1)." | ".g:tar_cmd." -".g:tar_browseoptions." - "
   else
    if tarfile =~ '^\s*-'
-    " A file name starting with a dash may be taken as an option.  Prepend ./ to avoid that.
+    " A file name starting with a dash is taken as an option.  Prepend ./ to avoid that.
     let tarfile = substitute(tarfile, '-', './-', '')
    endif
-"   call Decho("4: exe silent r! ".g:tar_cmd." -".g:tar_browseoptions." ".s:Escape(tarfile,1))
-   exe "silent r! ".g:tar_cmd." -".g:tar_browseoptions." ".s:Escape(tarfile,1)
+"   call Decho("4: exe silent r! ".g:tar_cmd." -".g:tar_browseoptions." ".shellescape(tarfile,0))
+   exe "silent r! ".g:tar_cmd." -".g:tar_browseoptions." ".shellescape(tarfile,1)
   endif
   if v:shell_error != 0
    redraw!
    echohl WarningMsg | echo "***warning*** (tar#Browse) please check your g:tar_browseoptions<".g:tar_browseoptions.">"
-"   call inputsave()|call input("Press <cr> to continue")|call inputrestore()
 "   call Dret("tar#Browse : a:tarfile<".a:tarfile.">")
    return
   endif
   if line("$") == curlast || ( line("$") == (curlast + 1) && getline("$") =~ '\c\%(warning\|error\|inappropriate\|unrecognized\)')
    redraw!
    echohl WarningMsg | echo "***warning*** (tar#Browse) ".a:tarfile." doesn't appear to be a tar file" | echohl None
-"   call inputsave()|call input("Press <cr> to continue")|call inputrestore()
    silent %d
    let eikeep= &ei
    set ei=BufReadCmd,FileReadCmd
@@ -189,7 +209,7 @@
 
   if !exists("g:tar_secure") && fname =~ '^\s*-\|\s\+-'
    redraw!
-   echohl WarningMsg | echo '***error*** (tar#BrowseSelect) rejecting tarfile member<'.fname.'> because of embedded "-"; See :help tar-options'
+   echohl WarningMsg | echo '***warning*** (tar#BrowseSelect) rejecting tarfile member<'.fname.'> because of embedded "-"'
 "   call Dret('tar#BrowseSelect : rejecting tarfile member<'.fname.'> because of embedded "-"')
    return
   endif
@@ -206,7 +226,7 @@
   let curfile= expand("%")
   if has("win32") && executable("cygpath")
    " assuming cygwin
-   let tarfile=substitute(system("cygpath -u ".s:Escape(tarfile,0)),'\n$','','e')
+   let tarfile=substitute(system("cygpath -u ".shellescape(tarfile,0)),'\n$','','e')
   endif
 
   new
@@ -231,21 +251,24 @@
   let fname   = substitute(a:fname,'tarfile:.\{-}::\(.*\)$','\1','')
   if has("win32") && executable("cygpath")
    " assuming cygwin
-   let tarfile=substitute(system("cygpath -u ".s:Escape(tarfile,0)),'\n$','','e')
+   let tarfile=substitute(system("cygpath -u ".shellescape(tarfile,0)),'\n$','','e')
   endif
 "  call Decho("tarfile<".tarfile.">")
 "  call Decho("fname<".fname.">")
 
-  if      fname =~ '\.gz$'  && executable("zcat")
+  if  fname =~ '\.bz2$' && executable("bzcat")
+   let decmp= "|bzcat"
+   let doro = 1
+  elseif      fname =~ '\.gz$'  && executable("zcat")
    let decmp= "|zcat"
    let doro = 1
-  elseif  fname =~ '\.bz2$' && executable("bzcat")
-   let decmp= "|bzcat"
+  elseif  fname =~ '\.lzma$' && executable("lzcat")
+   let decmp= "|lzcat"
    let doro = 1
   else
    let decmp=""
    let doro = 0
-   if fname =~ '\.gz$\|\.bz2$\|\.Z$\|\.zip$'
+   if fname =~ '\.bz2$\|\.gz$\|\.lzma$\|\.zip$\|\.Z$'
     setlocal bin
    endif
   endif
@@ -255,22 +278,25 @@
   else
    let tar_secure= " "
   endif
-  if tarfile =~# '\.\(gz\|tgz\)$'
-"   call Decho("5: exe silent r! gzip -d -c -- ".s:Escape(tarfile,1)."| ".g:tar_cmd.' -'.g:tar_readoptions.' - '.tar_secure.s:Escape(fname,1))
-   exe "silent r! gzip -d -c -- ".s:Escape(tarfile,1)."| ".g:tar_cmd." -".g:tar_readoptions." - ".tar_secure.s:Escape(fname,1).decmp
+  if tarfile =~# '\.bz2$'
+"   call Decho("7: exe silent r! bzip2 -d -c ".shellescape(tarfile,1)."| ".g:tar_cmd." -".g:tar_readoptions." - ".tar_secure.shellescape(fname,1).decmp)
+   exe "silent r! bzip2 -d -c -- ".shellescape(tarfile,1)."| ".g:tar_cmd." -".g:tar_readoptions." - ".tar_secure.shellescape(fname,1).decmp
+  elseif tarfile =~# '\.\(gz\|tgz\)$'
+"   call Decho("5: exe silent r! gzip -d -c -- ".shellescape(tarfile,1)."| ".g:tar_cmd.' -'.g:tar_readoptions.' - '.tar_secure.shellescape(fname,1))
+   exe "silent r! gzip -d -c -- ".shellescape(tarfile,1)."| ".g:tar_cmd." -".g:tar_readoptions." - ".tar_secure.shellescape(fname,1).decmp
   elseif tarfile =~# '\.lrp$'
-"   call Decho("6: exe silent r! cat ".s:Escape(tarfile,1)." | gzip -d -c - | ".g:tar_cmd." -".g:tar_readoptions." - ".tar_secure.s:Escape(fname,1).decmp)
-   exe "silent r! cat -- ".s:Escape(tarfile,1)." | gzip -d -c - | ".g:tar_cmd." -".g:tar_readoptions." - ".tar_secure.s:Escape(fname,1).decmp
-  elseif tarfile =~# '\.bz2$'
-"   call Decho("7: exe silent r! bzip2 -d -c ".s:Escape(tarfile,1)."| ".g:tar_cmd." -".g:tar_readoptions." - ".tar_secure.s:Escape(fname,1).decmp)
-   exe "silent r! bzip2 -d -c -- ".s:Escape(tarfile,1)."| ".g:tar_cmd." -".g:tar_readoptions." - ".tar_secure.s:Escape(fname,1).decmp
+"   call Decho("6: exe silent r! cat ".shellescape(tarfile,1)." | gzip -d -c - | ".g:tar_cmd." -".g:tar_readoptions." - ".tar_secure.shellescape(fname,1).decmp)
+   exe "silent r! cat -- ".shellescape(tarfile,1)." | gzip -d -c - | ".g:tar_cmd." -".g:tar_readoptions." - ".tar_secure.shellescape(fname,1).decmp
+  elseif tarfile =~# '\.lzma$'
+"   call Decho("7: exe silent r! lzma -d -c ".shellescape(tarfile,1)."| ".g:tar_cmd." -".g:tar_readoptions." - ".tar_secure.shellescape(fname,1).decmp)
+   exe "silent r! lzma -d -c -- ".shellescape(tarfile,1)."| ".g:tar_cmd." -".g:tar_readoptions." - ".tar_secure.shellescape(fname,1).decmp
   else
    if tarfile =~ '^\s*-'
-    " A file name starting with a dash may be taken as an option.  Prepend ./ to avoid that.
+    " A file name starting with a dash is taken as an option.  Prepend ./ to avoid that.
     let tarfile = substitute(tarfile, '-', './-', '')
    endif
-"   call Decho("8: exe silent r! ".g:tar_cmd." -".g:tar_readoptions." "s:Escape(tarfile,1).tar_secure..s:Escape(fname,1).decmp)
-   exe "silent r! ".g:tar_cmd." -".g:tar_readoptions." ".s:Escape(tarfile,1).tar_secure.s:Escape(fname,1).decmp
+"   call Decho("8: exe silent r! ".g:tar_cmd." -".g:tar_readoptions.tar_secure.shellescape(tarfile,1)." ".shellescape(fname,1).decmp)
+   exe "silent r! ".g:tar_cmd." -".g:tar_readoptions.shellescape(tarfile,1)." ".tar_secure.shellescape(fname,1).decmp
   endif
 
   if doro
@@ -298,7 +324,7 @@
 
   if !exists("g:tar_secure") && a:fname =~ '^\s*-\|\s\+-'
    redraw!
-   echohl WarningMsg | echo '***error*** (tar#Write) rejecting tarfile member<'.a:fname.'> because of embedded "-"; See :help tar-options'
+   echohl WarningMsg | echo '***warning*** (tar#Write) rejecting tarfile member<'.a:fname.'> because of embedded "-"'
 "   call Dret('tar#Write : rejecting tarfile member<'.fname.'> because of embedded "-"')
    return
   endif
@@ -307,7 +333,6 @@
   if !executable(g:tar_cmd)
    redraw!
    echohl Error | echo '***error*** (tar#Browse) "'.g:tar_cmd.'" not available on your system'
-"   call inputsave()|call input("Press <cr> to continue")|call inputrestore()
    let &report= repkeep
 "   call Dret("tar#Write")
    return
@@ -315,7 +340,6 @@
   if !exists("*mkdir")
    redraw!
    echohl Error | echo "***error*** (tar#Write) sorry, mkdir() doesn't work on your system" | echohl None
-"   call inputsave()|call input("Press <cr> to continue")|call inputrestore()
    let &report= repkeep
 "   call Dret("tar#Write")
    return
@@ -336,7 +360,6 @@
   catch /^Vim\%((\a\+)\)\=:E344/
    redraw!
    echohl Error | echo "***error*** (tar#Write) cannot cd to temporary directory" | Echohl None
-"   call inputsave()|call input("Press <cr> to continue")|call inputrestore()
    let &report= repkeep
 "   call Dret("tar#Write")
    return
@@ -355,29 +378,33 @@
   let fname   = substitute(w:tarfile,'tarfile:.\{-}::\(.*\)$','\1','')
 
   " handle compressed archives
-  if tarfile =~# '\.gz'
-   call system("gzip -d -- ".s:Escape(tarfile,0))
+  if tarfile =~# '\.bz2'
+   call system("bzip2 -d -- ".shellescape(tarfile,0))
+   let tarfile = substitute(tarfile,'\.bz2','','e')
+   let compress= "bzip2 -- ".shellescape(tarfile,0)
+"   call Decho("compress<".compress.">")
+  elseif tarfile =~# '\.gz'
+   call system("gzip -d -- ".shellescape(tarfile,0))
    let tarfile = substitute(tarfile,'\.gz','','e')
-   let compress= "gzip -- ".s:Escape(tarfile,0)
+   let compress= "gzip -- ".shellescape(tarfile,0)
+"   call Decho("compress<".compress.">")
+  elseif tarfile =~# '\.lzma'
+   call system("lzma -d -- ".shellescape(tarfile,0))
+   let tarfile = substitute(tarfile,'\.lzma','','e')
+   let compress= "lzma -- ".shellescape(tarfile,0)
 "   call Decho("compress<".compress.">")
   elseif tarfile =~# '\.tgz'
-   call system("gzip -d -- ".s:Escape(tarfile,0))
+   call system("gzip -d -- ".shellescape(tarfile,0))
    let tarfile = substitute(tarfile,'\.tgz','.tar','e')
-   let compress= "gzip -- ".s:Escape(tarfile,0)
+   let compress= "gzip -- ".shellescape(tarfile,0)
    let tgz     = 1
 "   call Decho("compress<".compress.">")
-  elseif tarfile =~# '\.bz2'
-   call system("bzip2 -d -- ".s:Escape(tarfile,0))
-   let tarfile = substitute(tarfile,'\.bz2','','e')
-   let compress= "bzip2 -- ".s:Escape(tarfile,0)
-"   call Decho("compress<".compress.">")
   endif
 "  call Decho("tarfile<".tarfile.">")
 
   if v:shell_error != 0
    redraw!
    echohl Error | echo "***error*** (tar#Write) sorry, unable to update ".tarfile." with ".fname | echohl None
-"   call inputsave()|call input("Press <cr> to continue")|call inputrestore()
   else
 
 "   call Decho("tarfile<".tarfile."> fname<".fname.">")
@@ -385,7 +412,7 @@
    if fname =~ '/'
     let dirpath = substitute(fname,'/[^/]\+$','','e')
     if executable("cygpath")
-     let dirpath = substitute(system("cygpath ".s:Escape(dirpath, 0)),'\n','','e')
+     let dirpath = substitute(system("cygpath ".shellescape(dirpath, 0)),'\n','','e')
     endif
     call mkdir(dirpath,"p")
    endif
@@ -405,25 +432,23 @@
    endif
    exe "w! ".fnameescape(fname)
    if executable("cygpath")
-    let tarfile = substitute(system("cygpath ".s:Escape(tarfile,0)),'\n','','e')
+    let tarfile = substitute(system("cygpath ".shellescape(tarfile,0)),'\n','','e')
    endif
  
    " delete old file from tarfile
-"   call Decho("system(".g:tar_cmd." --delete -f ".s:Escape(tarfile,0)." -- ".s:Escape(fname,0).")")
-   call system(g:tar_cmd." --delete -f ".s:Escape(tarfile,0).tar_secure.s:Escape(fname,0))
+"   call Decho("system(".g:tar_cmd." --delete -f ".shellescape(tarfile,0)." -- ".shellescape(fname,0).")")
+   call system(g:tar_cmd." --delete -f ".shellescape(tarfile,0).tar_secure.shellescape(fname,0))
    if v:shell_error != 0
     redraw!
     echohl Error | echo "***error*** (tar#Write) sorry, unable to update ".fnameescape(tarfile)." with ".fnameescape(fname) | echohl None
-"    call inputsave()|call input("Press <cr> to continue")|call inputrestore()
    else
  
     " update tarfile with new file 
-"    call Decho(g:tar_cmd." -".g:tar_writeoptions." ".s:Escape(tarfile,0).tar_secure.s:Escape(fname,0))
-    call system(g:tar_cmd." -".g:tar_writeoptions." ".s:Escape(tarfile,0).tar_secure.s:Escape(fname,0))
+"    call Decho(g:tar_cmd." -".g:tar_writeoptions." ".shellescape(tarfile,0).tar_secure.shellescape(fname,0))
+    call system(g:tar_cmd." -".g:tar_writeoptions." ".shellescape(tarfile,0).tar_secure.shellescape(fname,0))
     if v:shell_error != 0
      redraw!
      echohl Error | echo "***error*** (tar#Write) sorry, unable to update ".fnameescape(tarfile)." with ".fnameescape(fname) | echohl None
-"     call inputsave()|call input("Press <cr> to continue")|call inputrestore()
     elseif exists("compress")
 "     call Decho("call system(".compress.")")
      call system(compress)
@@ -439,13 +464,13 @@
 "    call Decho("handle writing <".tarfile."> across network to <".s:tblfile_{winnr()}.">")
     let tblfile= s:tblfile_{winnr()}
     1split|enew
-    let binkeep= &binary
+    let binkeep= &l:binary
     let eikeep = &ei
     set binary ei=all
     exe "e! ".fnameescape(tarfile)
     call netrw#NetWrite(tblfile)
-    let &ei     = eikeep
-    let &binary = binkeep
+    let &ei       = eikeep
+    let &l:binary = binkeep
     q!
     unlet s:tblfile_{winnr()}
    endif
@@ -462,38 +487,98 @@
 endfun
 
 " ---------------------------------------------------------------------
-" Rmdir: {{{2
+" s:Rmdir: {{{2
 fun! s:Rmdir(fname)
 "  call Dfunc("Rmdir(fname<".a:fname.">)")
   if has("unix")
-   call system("/bin/rm -rf -- ".s:Escape(a:fname,0))
+   call system("/bin/rm -rf -- ".shellescape(a:fname,0))
   elseif has("win32") || has("win95") || has("win64") || has("win16")
    if &shell =~? "sh$"
-    call system("/bin/rm -rf -- ".s:Escape(a:fname,0))
+    call system("/bin/rm -rf -- ".shellescape(a:fname,0))
    else
-    call system("del /S ".s:Escape(a:fname,0))
+    call system("del /S ".shellescape(a:fname,0))
    endif
   endif
 "  call Dret("Rmdir")
 endfun
 
 " ---------------------------------------------------------------------
-" s:Escape: {{{2
-fun s:Escape(name,isfilt)
-  " shellescape() was added by patch 7.0.111
-  if exists("*shellescape")
-   if a:isfilt
-    let qnameq= shellescape(a:name,1)
+" tar#Vimuntar: installs a tarball in the user's .vim / vimfiles directory {{{2
+fun! tar#Vimuntar(...)
+"  call Dfunc("tar#Vimuntar() a:0=".a:0." a:1<".(exists("a:1")? a:1 : "-n/a-").">")
+  let tarball = expand("%")
+"  call Decho("tarball<".tarball.">")
+  let tarbase = substitute(tarball,'\..*$','','')
+"  call Decho("tarbase<".tarbase.">")
+  let tarhome = expand("%:p")
+  if has("win32") || has("win95") || has("win64") || has("win16")
+   let tarhome= substitute(tarhome,'\\','/','g')
+  endif
+  let tarhome= substitute(tarhome,'/[^/]*$','','')
+"  call Decho("tarhome<".tarhome.">")
+  let tartail = expand("%:t")
+"  call Decho("tartail<".tartail.">")
+  let curdir  = getcwd()
+"  call Decho("curdir <".curdir.">")
+  " set up vimhome
+  if a:0 > 0 && a:1 != ""
+   let vimhome= a:1
+  else
+   let vimhome= vimball#VimballHome()
+  endif
+"  call Decho("vimhome<".vimhome.">")
+
+"  call Decho("curdir<".curdir."> vimhome<".vimhome.">")
+  if simplify(curdir) != simplify(vimhome)
+   " copy (possibly compressed) tarball to .vim/vimfiles
+"   call Decho(netrw#WinPath(g:tar_copycmd)." ".shellescape(tartail)." ".shellescape(vimhome))
+   call system(netrw#WinPath(g:tar_copycmd)." ".shellescape(tartail)." ".shellescape(vimhome))
+"   call Decho("exe cd ".fnameescape(vimhome))
+   exe "cd ".fnameescape(vimhome)
+  endif
+"  call Decho("getcwd<".getcwd().">")
+
+  " if necessary, decompress the tarball; then, extract it
+  if tartail =~ '\.tgz'
+   if executable("gunzip")
+    silent exe "!gunzip ".shellescape(tartail)
+   elseif executable("gzip")
+    silent exe "!gzip -d ".shellescape(tartail)
    else
-    let qnameq= shellescape(a:name)
+    echoerr "unable to decompress<".tartail."> on this sytem"
+    if simplify(curdir) != simplify(tarhome)
+     " remove decompressed tarball, restore directory
+"     call Decho("delete(".tartail.".tar)")
+     call delete(tartail.".tar")
+"     call Decho("exe cd ".fnameescape(curdir))
+     exe "cd ".fnameescape(curdir)
+    endif
+"    call Dret("tar#Vimuntar")
+    return
    endif
   else
-   let qnameq= g:tar_shq . a:name . g:tar_shq
+   call vimball#Decompress(tartail,0)
   endif
-  return qnameq
+  let extractcmd= netrw#WinPath(g:tar_extractcmd)
+"  call Decho("system(".extractcmd." ".shellescape(tarbase.".tar").")")
+  call system(extractcmd." ".shellescape(tarbase.".tar"))
+
+  " set up help
+  if filereadable("doc/".tarbase.".txt")
+"   call Decho("exe helptags ".getcwd()."/doc")
+   exe "helptags ".getcwd()."/doc"
+  endif
+
+  if simplify(tarhome) != simplify(vimhome)
+   " remove decompressed tarball, restore directory
+   call delete(vimhome."/".tarbase.".tar")
+   exe "cd ".fnameescape(curdir)
+  endif
+
+"  call Dret("tar#Vimuntar")
 endfun
 
-" ---------------------------------------------------------------------
+" =====================================================================
 " Modelines And Restoration: {{{1
 let &cpo= s:keepcpo
 unlet s:keepcpo
diff --git a/runtime/autoload/vimball.vim b/runtime/autoload/vimball.vim
index 4f6292b..b97c3a5 100644
--- a/runtime/autoload/vimball.vim
+++ b/runtime/autoload/vimball.vim
@@ -1,9 +1,9 @@
 " vimball.vim : construct a file containing both paths and files
 " Author:	Charles E. Campbell, Jr.
-" Date:		Jul 30, 2008
-" Version:	29
+" Date:		Dec 28, 2009
+" Version:	30
 " GetLatestVimScripts: 1502 1 :AutoInstall: vimball.vim
-" Copyright: (c) 2004-2008 by Charles E. Campbell, Jr.
+" Copyright: (c) 2004-2009 by Charles E. Campbell, Jr.
 "            The VIM LICENSE applies to Vimball.vim, and Vimball.txt
 "            (see |copyright|) except use "Vimball" instead of "Vim".
 "            No warranty, express or implied.
@@ -11,11 +11,17 @@
 
 " ---------------------------------------------------------------------
 "  Load Once: {{{1
-if &cp || exists("g:loaded_vimball") || v:version < 700
+if &cp || exists("g:loaded_vimball")
  finish
 endif
-let s:keepcpo        = &cpo
-let g:loaded_vimball = "v29"
+let g:loaded_vimball = "v30"
+if v:version < 702
+ echohl WarningMsg
+ echo "***warning*** this version of vimball needs vim 7.2"
+ echohl Normal
+ finish
+endif
+let s:keepcpo= &cpo
 set cpo&vim
 "DechoTabOn
 
@@ -52,30 +58,6 @@
    call vimball#ShowMesg(s:WARNING,"(vimball) g:vimball_mkdir undefined")
   endif
  endif
-
- " set up shell quoting character
- if exists("g:vimball_shq") && !exists("g:netrw_shq")
-  let g:netrw_shq= g:vimball_shq
- endif
- if !exists("g:netrw_shq")
-  if exists("&shq") && &shq != ""
-   let g:netrw_shq= &shq
-  elseif has("win32") || has("win95") || has("win64") || has("win16")
-   if g:netrw_cygwin
-    let g:netrw_shq= "'"
-   else
-    let g:netrw_shq= '"'
-   endif
-  else
-   let g:netrw_shq= "'"
-  endif
-" call Decho("g:netrw_shq<".g:netrw_shq.">")
- endif
-
- " set up escape string (used to protect paths)
- if !exists("g:vimball_path_escape")
-  let g:vimball_path_escape= ' ;#%'
- endif
 endif
 
 " =====================================================================
@@ -106,8 +88,8 @@
    let vbname= vbname.'.vba'
   endif
 "  call Decho("vbname<".vbname.">")
-  if a:1 =~ '[\/]'
-   call vimball#ShowMesg(s:ERROR,"(MkVimball) vimball name<".a:1."> should not include slashes")
+  if !a:writelevel && a:1 =~ '[\/]'
+   call vimball#ShowMesg(s:ERROR,"(MkVimball) vimball name<".a:1."> should not include slashes; use ! to insist")
 "   call Dret("MkVimball : vimball name<".a:1."> should not include slashes")
    return
   endif
@@ -125,7 +107,7 @@
    let home= expand(a:2)
   else
    " use first existing directory from rtp
-   let home= s:VimballHome()
+   let home= vimball#VimballHome()
   endif
 
   " save current directory
@@ -218,7 +200,7 @@
    return
   endif
 
-  if getline(1) !~ '^" Vimball Archiver by Charles E. Campbell, Jr., Ph.D.$'
+  if getline(1) !~ '^" Vimball Archiver'
    echoerr "(Vimball) The current file does not appear to be a Vimball!"
 "   call Dret("vimball#Vimball")
    return
@@ -240,7 +222,7 @@
   if a:0 > 0
    let home= expand(a:1)
   else
-   let home= s:VimballHome()
+   let home= vimball#VimballHome()
   endif
 "  call Decho("home<".home.">")
 
@@ -272,7 +254,9 @@
   while 1 < linenr && linenr < line("$")
    let fname   = substitute(getline(linenr),'\t\[\[\[1$','','')
    let fname   = substitute(fname,'\\','/','g')
-   let fsize   = getline(linenr+1)+0
+"   let fsize   = getline(linenr+1)+0
+   let fsize   = substitute(getline(linenr+1),'^\(\d\+\).\{-}$','\1','')+0
+   let fenc    = substitute(getline(linenr+1),'^\d\+\s*\(\S\+\)$','\1','')
    let filecnt = filecnt + 1
 "   call Decho("fname<".fname."> fsize=".fsize." filecnt=".filecnt)
 
@@ -307,7 +291,7 @@
      if !isdirectory(dirname)
 "      call Decho("making <".dirname.">")
       if exists("g:vimball_mkdir")
-	   call system(g:vimball_mkdir." ".s:Escape(dirname))
+	   call system(g:vimball_mkdir." ".shellescape(dirname))
       else
        call mkdir(dirname)
       endif
@@ -337,9 +321,13 @@
    if a:really
     let fnamepath= home."/".fname
 "    call Decho("exe w! ".fnameescape(fnamepath))
-	exe "silent w! ".fnameescape(fnamepath)
-    echo "wrote ".fnamepath
-	call s:RecordInVar(home,"call delete('".fnameescape(fnamepath)."')")
+	if fenc != ""
+	 exe "silent w! ++enc=".fnameescape(fenc)." ".fnameescape(fnamepath)
+	else
+	 exe "silent w! ".fnameescape(fnamepath)
+	endif
+	echo "wrote ".fnameescape(fnamepath)
+	call s:RecordInVar(home,"call delete('".fnamepath."')")
    endif
 
    " return to tab with vimball
@@ -418,7 +406,7 @@
   if a:0 >= 2
    let home= expand(a:2)
   else
-   let home= s:VimballHome()
+   let home= vimball#VimballHome()
   endif
   let curdir = getcwd()
 "  call Decho("home   <".home.">")
@@ -432,19 +420,20 @@
    keepalt keepjumps 1split 
    silent! keepalt keepjumps e .VimballRecord
    let keepsrch= @/
-"   call Decho("search for ^".curfile.".vba:")
-"   call Decho("search for ^".curfile."[-0-9.]*.vba:")
-   if search('^'.curfile.": ".'cw')
+"   call Decho('search for ^\M'.curfile.'.\m: ')
+"   call Decho('search for ^\M'.curfile.'.\mvba: ')
+"   call Decho('search for ^\M'.curfile.'\m[-0-9.]*\.vba: ')
+   if search('^\M'.curfile."\m: ".'cw')
 	let foundit= 1
-   elseif search('^'.curfile.".vba: ",'cw')
+   elseif search('^\M'.curfile.".\mvba: ",'cw')
 	let foundit= 1
-   elseif search('^'.curfile.'[-0-9.]*.vba: ','cw')
+   elseif search('^\M'.curfile.'\m[-0-9.]*\.vba: ','cw')
 	let foundit= 1
    else
     let foundit = 0
    endif
    if foundit
-	let exestring  = substitute(getline("."),'^'.curfile.'\S\{-}\.vba: ','','')
+	let exestring  = substitute(getline("."),'^\M'.curfile.'\m\S\{-}\.vba: ','','')
     let s:VBRstring= substitute(exestring,'call delete(','','g')
     let s:VBRstring= substitute(s:VBRstring,"[')]",'','g')
 "	call Decho("exe ".exestring)
@@ -472,62 +461,62 @@
 
 " ---------------------------------------------------------------------
 " vimball#Decompress: attempts to automatically decompress vimballs {{{2
-fun! vimball#Decompress(fname)
-"  call Dfunc("Decompress(fname<".a:fname.">)")
+fun! vimball#Decompress(fname,...)
+"  call Dfunc("Decompress(fname<".a:fname.">) a:0=".a:0)
 
   " decompression:
   if     expand("%") =~ '.*\.gz'  && executable("gunzip")
    " handle *.gz with gunzip
-   silent exe "!gunzip ".s:Escape(a:fname)
+   silent exe "!gunzip ".shellescape(a:fname)
    if v:shell_error != 0
 	call vimball#ShowMesg(s:WARNING,"(vimball#Decompress) gunzip may have failed with <".a:fname.">")
    endif
    let fname= substitute(a:fname,'\.gz$','','')
    exe "e ".escape(fname,' \')
-   call vimball#ShowMesg(s:USAGE,"Source this file to extract it! (:so %)")
+   if a:0 == 0| call vimball#ShowMesg(s:USAGE,"Source this file to extract it! (:so %)") | endif
 
   elseif expand("%") =~ '.*\.gz' && executable("gzip")
    " handle *.gz with gzip -d
-   silent exe "!gzip -d ".s:Escape(a:fname)
+   silent exe "!gzip -d ".shellescape(a:fname)
    if v:shell_error != 0
 	call vimball#ShowMesg(s:WARNING,'(vimball#Decompress) "gzip -d" may have failed with <'.a:fname.">")
    endif
    let fname= substitute(a:fname,'\.gz$','','')
    exe "e ".escape(fname,' \')
-   call vimball#ShowMesg(s:USAGE,"Source this file to extract it! (:so %)")
+   if a:0 == 0| call vimball#ShowMesg(s:USAGE,"Source this file to extract it! (:so %)") | endif
 
   elseif expand("%") =~ '.*\.bz2' && executable("bunzip2")
    " handle *.bz2 with bunzip2
-   silent exe "!bunzip2 ".s:Escape(a:fname)
+   silent exe "!bunzip2 ".shellescape(a:fname)
    if v:shell_error != 0
 	call vimball#ShowMesg(s:WARNING,"(vimball#Decompress) bunzip2 may have failed with <".a:fname.">")
    endif
    let fname= substitute(a:fname,'\.bz2$','','')
    exe "e ".escape(fname,' \')
-   call vimball#ShowMesg(s:USAGE,"Source this file to extract it! (:so %)")
+   if a:0 == 0| call vimball#ShowMesg(s:USAGE,"Source this file to extract it! (:so %)") | endif
 
   elseif expand("%") =~ '.*\.bz2' && executable("bzip2")
    " handle *.bz2 with bzip2 -d
-   silent exe "!bzip2 -d ".s:Escape(a:fname)
+   silent exe "!bzip2 -d ".shellescape(a:fname)
    if v:shell_error != 0
 	call vimball#ShowMesg(s:WARNING,'(vimball#Decompress) "bzip2 -d" may have failed with <'.a:fname.">")
    endif
    let fname= substitute(a:fname,'\.bz2$','','')
    exe "e ".escape(fname,' \')
-   call vimball#ShowMesg(s:USAGE,"Source this file to extract it! (:so %)")
+   if a:0 == 0| call vimball#ShowMesg(s:USAGE,"Source this file to extract it! (:so %)") | endif
 
   elseif expand("%") =~ '.*\.zip' && executable("unzip")
    " handle *.zip with unzip
-   silent exe "!unzip ".s:Escape(a:fname)
+   silent exe "!unzip ".shellescape(a:fname)
    if v:shell_error != 0
 	call vimball#ShowMesg(s:WARNING,"(vimball#Decompress) unzip may have failed with <".a:fname.">")
    endif
    let fname= substitute(a:fname,'\.zip$','','')
    exe "e ".escape(fname,' \')
-   call vimball#ShowMesg(s:USAGE,"Source this file to extract it! (:so %)")
+   if a:0 == 0| call vimball#ShowMesg(s:USAGE,"Source this file to extract it! (:so %)") | endif
   endif
 
-  set noma bt=nofile fmr=[[[,]]] fdm=marker
+  if a:0 == 0| setlocal noma bt=nofile fmr=[[[,]]] fdm=marker | endif
 
 "  call Dret("Decompress")
 endfun
@@ -536,20 +525,21 @@
 " vimball#ShowMesg: {{{2
 fun! vimball#ShowMesg(level,msg)
 "  call Dfunc("vimball#ShowMesg(level=".a:level." msg<".a:msg.">)")
+
   let rulerkeep   = &ruler
   let showcmdkeep = &showcmd
   set noruler noshowcmd
   redraw!
 
   if &fo =~ '[ta]'
-   echomsg "***vimball*** " a:msg
+   echomsg "***vimball*** ".a:msg
   else
    if a:level == s:WARNING || a:level == s:USAGE
     echohl WarningMsg
    elseif a:level == s:ERROR
     echohl Error
    endif
-   echomsg "***vimball*** " a:msg
+   echomsg "***vimball*** ".a:msg
    echohl None
   endif
 
@@ -646,9 +636,9 @@
 endfun
 
 " ---------------------------------------------------------------------
-" s:VimballHome: determine/get home directory path (usually from rtp) {{{2
-fun! s:VimballHome()
-"  call Dfunc("VimballHome()")
+" vimball#VimballHome: determine/get home directory path (usually from rtp) {{{2
+fun! vimball#VimballHome()
+"  call Dfunc("vimball#VimballHome()")
   if exists("g:vimball_home")
    let home= g:vimball_home
   else
@@ -674,14 +664,14 @@
   if !isdirectory(home)
    if exists("g:vimball_mkdir")
 "	call Decho("home<".home."> isn't a directory -- making it now with g:vimball_mkdir<".g:vimball_mkdir.">")
-"    call Decho("system(".g:vimball_mkdir." ".s:Escape(home).")")
-    call system(g:vimball_mkdir." ".s:Escape(home))
+"    call Decho("system(".g:vimball_mkdir." ".shellescape(home).")")
+    call system(g:vimball_mkdir." ".shellescape(home))
    else
 "	call Decho("home<".home."> isn't a directory -- making it now with mkdir()")
     call mkdir(home)
    endif
   endif
-"  call Dret("VimballHome <".home.">")
+"  call Dret("vimball#VimballHome <".home.">")
   return home
 endfun
 
@@ -743,20 +733,5 @@
 endfun
 
 " ---------------------------------------------------------------------
-" s:Escape: {{{2
-fun s:Escape(name)
-  " shellescape() was added by patch 7.0.111
-  if exists("*shellescape")
-    return shellescape(a:name)
-  endif
-  return g:netrw_shq . a:name . g:netrw_shq
-endfun
-
-" ---------------------------------------------------------------------
-"  Restore:
-let &cpo= s:keepcpo
-unlet s:keepcpo
-
-" ---------------------------------------------------------------------
 " Modelines: {{{1
 " vim: fdm=marker