changeset 466:7a01bd1ac566

updated for version 7.0125
author vimboss
date Mon, 08 Aug 2005 22:00:59 +0000
parents 49669e1a7c5c
children 9361ad7756e8
files runtime/doc/pi_netrw.txt runtime/plugin/netrw.vim
diffstat 2 files changed, 85 insertions(+), 40 deletions(-) [+]
line wrap: on
line diff
--- a/runtime/doc/pi_netrw.txt
+++ b/runtime/doc/pi_netrw.txt
@@ -1,4 +1,4 @@
-*pi_netrw.txt*  For Vim version 7.0.  Last change: Aug 04, 2005
+*pi_netrw.txt*  For Vim version 7.0.  Last change: Aug 08, 2005
 
 
 		VIM REFERENCE MANUAL    by Charles E. Campbell, Jr.
@@ -171,7 +171,7 @@ 1. Netrw Reference						*netrw-ref*
 
 		example:  vim scp://user@host/somefile
 		example:  vim scp://user@host/subdir1/subdir2/somefile
-	
+
 	where "somefile" is the "user"'s home directory.  If you wish to get a
 	file using root-relative paths, use the full path:
 
@@ -741,8 +741,9 @@ trailing slash and it will be interprete
 If you'd like to avoid entering the password in for directory listings, scp,
 ssh interaction, etc, see |netrw-list-hack|.
 
-
-DIRECTORY EXPLORING COMMANDS						*netrw-explore*
+				*netrw-explore*  *netrw-pexplore*
+				*netrw-hexplore* *netrw-sexplore*
+DIRECTORY EXPLORING COMMANDS	*netrw-nexplore* *netrw-vexplore*
 
      :Explore[!]   [dir]... Explore directory of current file
      :Sexplore[!]  [dir]... Split & Explore directory of current file
@@ -752,38 +753,51 @@ DIRECTORY EXPLORING COMMANDS						*netrw
      :Pexplore............. used with **/patterns; go to previous matching file
 
 The Explore command will open the local-directory browser on the current
-file's directory (or on directory [dir] if specified).  The window
-will be split only if the file has been modified, otherwise the
-browsing window will take over that window.  Normally the splitting is
-taken horizontally; the optional ! will use vertical splitting.
+file's directory (or on directory [dir] if specified).  The window will be
+split only if the file has been modified, otherwise the browsing window will
+take over that window.  Normally the splitting is taken horizontally; the
+optional ! will use vertical splitting.
 
 Sexplore will always split the window before invoking the local-directory
-browser.  As with Explore, the splitting is normally done horizontally,
-but with the optional ! the splitting will be done vertically.
+browser.  As with Explore, the splitting is normally done horizontally, but
+with the optional ! the splitting will be done vertically.
 
 Hexplore does an Explore with |belowright| horizontal splitting; the
 optional ! does the Explore with |aboveleft| horizontal splitting.
 
-Vexplore does an Explore with |leftabove| vertical splitting; the optiona
-! does an Explore with |topleft| vertical splitting.
+Vexplore does an Explore with |leftabove| vertical splitting; the
+optional "!" does an Explore with |topleft| vertical splitting.
 
-(Following needs v7.0 or later)
-When Explore, Sexplore, Hexplore, or Vexplore are used with
-**/filename-patterns, netrw will attempt to find a (sub)directory which
-matches the filename pattern.  The Nexplore and Pexplore commands enable
-one to proceed to the next/previous matching file, respectively.  If your
-console or gui produce recognizable shift-up or shift-down sequences, then
+(Following needs v7.0 or later)			*netrw-starstar*
+When Explore, Sexplore, Hexplore, or Vexplore are used like
+>
+	:Explore **/filename_pattern
+<
+netrw will attempt to find a (sub)directory which matches the filename
+pattern.  Internally, it produces a list of files which match the pattern
+and their paths; to that extent it resembles the Unix operation:
+>
+	find $(pwd) -name "$1" -exec "echo" "{}" ";" 2> /dev/null
+<
+The directory display is updated to show the subdirectory containing a
+matching file.  One may then proceed to the next (or previous) matching files'
+directories by using Nexplore or Pexplore, respectively.  If your console or
+gui produces recognizable shift-up or shift-down sequences, then you'll likely
+find the following mappings convenient:
 
 	<s-down>  == Nexplore, and
 	<s-up>    == Pexplore.
 
-As an example, consider >
-
+As an example, consider
+>
 	:Explore **/*.c
 	:Nexplore
 	:Nexplore
 	:Pexplore
 <
+The status line will show, on the right hand side of the status line, a
+message like "Match 3 of 20".
+
 
 REFRESHING THE LISTING					*netrw-ctrl-l*
 
@@ -1066,8 +1080,8 @@ 8. Problems and Fixes						*netrw-proble
 		<.vimrc> file:
 
 			let g:netrw_win95ftp= 1
-		
-		
+
+
 
 	P2. I use windows, and my network browsing with ftp doesn't sort by
 	    time or size
@@ -1113,7 +1127,7 @@ 8. Problems and Fixes						*netrw-proble
 	    How do I do that?
 
 	    	let g:netrw_keepdir= 0
-	
+
 
 ==============================================================================
 9. Debugging						*netrw-debug*
@@ -1132,7 +1146,7 @@ which is loaded automatically at startup
 		http://vim.sourceforge.net/scripts/script.php?script_id=120
 
 	   and put it into your local plugin directory.
-	
+
 	2. <Decho.vim> itself needs the <cecutil.vim> script, so you'll need
 	   to put it into your .vim/plugin, too.  You may obtain it from:
 
@@ -1165,6 +1179,8 @@ which is loaded automatically at startup
 ==============================================================================
 10. History						*netrw-history*
 
+	v59: * bugfix -- another keepalt work-around installed (for vim6.3)
+	     * "Match # of #" for Explore **/pattern matches
 	v58: * Explore and relatives can now handle **/somefilepattern (v7)
 	     * Nexplore and Pexplore introduced (v7).  shift-down and shift-up
 	       cursor keys will invoke Nexplore and Pexplore, respectively.
--- a/runtime/plugin/netrw.vim
+++ b/runtime/plugin/netrw.vim
@@ -1,7 +1,7 @@
 " netrw.vim: Handles file transfer and remote directory listing across a network
-" Last Change:	Aug 05, 2005
+" Last Change:	Aug 08, 2005
 " Maintainer:	Charles E Campbell, Jr <drchipNOSPAM at campbellfamily dot biz>
-" Version:	58e	ASTRO-ONLY
+" Version:	59
 " License:	Vim License  (see vim's :help license)
 " Copyright:    Copyright (C) 1999-2005 Charles E. Campbell, Jr.
 "               Permission is hereby granted to use and distribute this code,
@@ -22,7 +22,7 @@
 if exists("g:loaded_netrw") || &cp
   finish
 endif
-let g:loaded_netrw  = "v58e"
+let g:loaded_netrw  = "v59"
 let loaded_explorer = 1
 let s:keepcpo       = &cpo
 set cpo&vim
@@ -2150,7 +2150,11 @@ fun! <SID>LocalBrowse(dirname)
 
   " make this buffer modifiable and hidden
   setlocal ma hidden nonu
-  keepalt silent! %d
+  if v:version < 700
+   silent! %d
+  else
+   keepalt silent! %d
+  endif
 
   " ---------------------------
   "  Perform Directory Listing:
@@ -2650,31 +2654,40 @@ fun! s:Explore(indx,dosplit,style,...)
   elseif a:1 =~ '\*\*/' || a:indx < 0
 
    if has("path_extra")
-    if !exists("s:indx")
-     let s:indx= 0
+    if !exists("s:explore_indx")
+     let s:explore_indx= 0
     endif
     let indx = a:indx
     if indx == -1
-     let indx= s:indx + 1
+     let indx= s:explore_indx + 1
     elseif indx == -2
-     let indx= s:indx - 1
+     let indx= s:explore_indx - 1
     else
-     let s:indx        = 0
-     let s:explorelist = split(expand(b:netrw_curdir."/".a:1),'\n')
-     let s:listlen     = len(s:explorelist)
-     if s:listlen == 1 && s:explorelist[0] =~ '\*\*\/'
+     let s:explore_indx    = 0
+     if !exists("b:netrw_curdir")
+       let b:netrw_curdir = "."
+     endif
+     let s:explorelist     = split(expand(b:netrw_curdir."/".a:1),'\n')
+     let s:explore_listlen = len(s:explorelist)
+     if s:explore_listlen == 1 && s:explorelist[0] =~ '\*\*\/'
       echohl WarningMsg | echo "***netrw*** no files matched" | echohl None
       call inputsave()|call input("Press <cr> to continue")|call inputrestore()
 "      call Dret("Explore")
       return
      endif
     endif
-    let s:indx = indx
-"    call Decho("explorelist<".join(s:explorelist,',')."> len=".s:listlen)
+
+    " NetrwStatusLine support
+    let s:explore_indx  = indx
+    if !exists("s:netrw_explore_stl")
+     let s:netrw_explore_stl= &stl
+    endif
+    set stl=%f\ %h%m%r%=%{NetrwStatusLine()}
+"    call Decho("explorelist<".join(s:explorelist,',')."> len=".s:explore_listlen)
 
     " sanity check
-    if indx >= s:listlen || indx < 0
-     let indx= (indx < 0)? 0 : ( s:listlen - 1 )
+    if indx >= s:explore_listlen || indx < 0
+     let indx= (indx < 0)? 0 : ( s:explore_listlen - 1 )
      echohl WarningMsg | echo "***netrw*** no more files match Explore pattern" | echohl None
      call inputsave()|call input("Press <cr> to continue")|call inputrestore()
 "     call Dret("Explore")
@@ -2688,6 +2701,9 @@ fun! s:Explore(indx,dosplit,style,...)
 "    call Decho("calling LocalBrowse(newdir<".newdir.">)")
     call s:LocalBrowse(newdir)
     call search(substitute(dirfile,"^.*/","",""),"W")
+    let s:explore_mtchcnt = indx + 1
+    let s:explore_bufnr   = bufnr(".")
+    let s:explore_line    = line(".")
 
    else
     if v:version < 700
@@ -2708,6 +2724,19 @@ fun! s:Explore(indx,dosplit,style,...)
 endfun
 
 " ---------------------------------------------------------------------
+" NetrwStatusLine: {{{2
+fun! NetrwStatusLine()
+  let g:explore_bufnr= s:explore_bufnr
+  let g:explore_line= s:explore_line
+  if !exists("s:explore_bufnr") || s:explore_bufnr != bufnr(".") || !exists("s:explore_line") || s:explore_line != line(".")
+   let &stl= s:netrw_explore_stl
+   return ""
+  else
+   return "Match ".s:explore_mtchcnt." of ".s:explore_listlen
+  endif
+endfun
+
+" ---------------------------------------------------------------------
 " NetGetcwd: get the current directory. {{{2
 "   Change backslashes to forward slashes, if any.
 "   If doesc is true, escape certain troublesome characters