summaryrefslogtreecommitdiffstats
path: root/runtime/plugin/netrw.vim
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/plugin/netrw.vim')
-rw-r--r--runtime/plugin/netrw.vim60
1 files changed, 57 insertions, 3 deletions
diff --git a/runtime/plugin/netrw.vim b/runtime/plugin/netrw.vim
index 0b7c616af6..85d7df7439 100644
--- 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 10, 2005
+" Last Change: Aug 12, 2005
" Maintainer: Charles E Campbell, Jr <drchipNOSPAM at campbellfamily dot biz>
-" Version: 60
+" Version: 61
" 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 = "v60"
+let g:loaded_netrw = "v61"
if v:version < 700
let loaded_explorer = 1
endif
@@ -1079,6 +1079,9 @@ fun! <SID>NetBrowse(dirname)
return
endif
+ " use buffer-oriented WinVars if buffer ones exist but window ones don't
+ call s:UseBufWinVars()
+
" make this buffer modifiable
setlocal ma nonu nowrap
@@ -1161,6 +1164,9 @@ fun! <SID>NetBrowse(dirname)
exe "silent doau BufReadPost ".fname
keepjumps 1d
+ " save certain window-oriented variables into buffer-oriented variables
+ call s:BufWinVars()
+
setlocal nonu nomod noma
" call Dret("NetBrowse : file<".fname.">")
@@ -1429,6 +1435,8 @@ endfun
" NetGetWord: it gets the directory named under the cursor
fun! <SID>NetGetWord()
" call Dfunc("NetGetWord() line#".line("."))
+ call s:UseBufWinVars()
+
if exists("w:netrw_bannercnt") && line(".") < w:netrw_bannercnt
let dirname= "./"
let curline= getline(".")
@@ -2166,6 +2174,9 @@ fun! <SID>LocalBrowse(dirname)
set noautochdir
endif
+ " use buffer-oriented WinVars if buffer ones exist but window ones don't
+ call s:UseBufWinVars()
+
" find buffer number of buffer named precisely the same as a:dirname
let bufnum= bufnr(a:dirname)
" call Decho("findbuf: bufnum=".bufnum)
@@ -2380,6 +2391,9 @@ fun! <SID>LocalBrowse(dirname)
" record previous current directory
let w:netrw_prvdir= b:netrw_curdir
+ " save certain window-oriented variables into buffer-oriented variables
+ call s:BufWinVars()
+
setlocal noma nomod nonu bh=hide nobl
if has("netbeans_intg") || has("sun_workshop")
let &autochdir= keep_autochdir
@@ -3299,6 +3313,7 @@ fun! s:SaveWinVars()
if exists("w:netrw_explore_mtchcnt")|let s:explore_mtchcnt = w:netrw_explore_mtchcnt|endif
if exists("w:netrw_explore_bufnr") |let s:explore_bufnr = w:netrw_explore_bufnr |endif
if exists("w:netrw_explore_line") |let s:explore_line = w:netrw_explore_line |endif
+ if exists("w:netrw_explore_list") |let s:explore_list = w:netrw_explore_list |endif
" call Dret("SaveWinVars")
endfun
@@ -3314,9 +3329,48 @@ fun! s:CopyWinVars()
if exists("s:explore_mtchcnt")|let w:netrw_explore_mtchcnt = s:explore_mtchcnt|unlet s:explore_mtchcnt|endif
if exists("s:explore_bufnr") |let w:netrw_explore_bufnr = s:explore_bufnr |unlet s:explore_bufnr |endif
if exists("s:explore_line") |let w:netrw_explore_line = s:explore_line |unlet s:explore_line |endif
+ if exists("s:explore_list") |let w:netrw_explore_list = s:explore_list |unlet s:explore_list |endif
" call Dret("CopyWinVars")
endfun
+" ---------------------------------------------------------------------
+" BufWinVars: (used by NetBrowse() and LocalBrowse()) {{{1
+" To allow separate windows to have their own activities, such as
+" Explore **/pattern, several variables have been made window-oriented.
+" However, when the user splits a browser window (ex: ctrl-w s), these
+" variables are not inherited by the new window. BufWinVars() and
+" UseBufWinVars() get around that.
+fun! s:BufWinVars()
+" call Dfunc("BufWinVars()")
+ 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
+ if exists("w:netrw_prvdir") |let b:netrw_prvdir = w:netrw_prvdir |endif
+ if exists("w:netrw_explore_indx") |let b:netrw_explore_indx = w:netrw_explore_indx |endif
+ if exists("w:netrw_explore_listlen")|let b:netrw_explore_listlen = w:netrw_explore_listlen|endif
+ if exists("w:netrw_explore_mtchcnt")|let b:netrw_explore_mtchcnt = w:netrw_explore_mtchcnt|endif
+ if exists("w:netrw_explore_bufnr") |let b:netrw_explore_bufnr = w:netrw_explore_bufnr |endif
+ if exists("w:netrw_explore_line") |let b:netrw_explore_line = w:netrw_explore_line |endif
+ if exists("w:netrw_explore_list") |let b:netrw_explore_list = w:netrw_explore_list |endif
+" call Dret("BufWinVars")
+endfun
+
+" ---------------------------------------------------------------------
+" UseBufWinVars: (used by NetBrowse() and LocalBrowse() {{{1
+" Matching function to BufferWinVars()
+fun! s:UseBufWinVars()
+" call Dfunc("UseBufWinVars()")
+ if exists("b:netrw_bannercnt") && !exists("w:netrw_bannercnt") |let w:netrw_bannercnt = b:netrw_bannercnt |endif
+ if exists("b:netrw_method") && !exists("w:netrw_method") |let w:netrw_method = b:netrw_method |endif
+ if exists("b:netrw_prvdir") && !exists("w:netrw_prvdir") |let w:netrw_prvdir = b:netrw_prvdir |endif
+ if exists("b:netrw_explore_indx") && !exists("w:netrw_explore_indx") |let w:netrw_explore_indx = b:netrw_explore_indx |endif
+ if exists("b:netrw_explore_listlen") && !exists("w:netrw_explore_listlen")|let w:netrw_explore_listlen = b:netrw_explore_listlen|endif
+ if exists("b:netrw_explore_mtchcnt") && !exists("w:netrw_explore_mtchcnt")|let w:netrw_explore_mtchcnt = b:netrw_explore_mtchcnt|endif
+ if exists("b:netrw_explore_bufnr") && !exists("w:netrw_explore_bufnr") |let w:netrw_explore_bufnr = b:netrw_explore_bufnr |endif
+ if exists("b:netrw_explore_line") && !exists("w:netrw_explore_line") |let w:netrw_explore_line = b:netrw_explore_line |endif
+ if exists("b:netrw_explore_list") && !exists("w:netrw_explore_list") |let w:netrw_explore_list = b:netrw_explore_list |endif
+" call Dret("UseBufWinVars")
+endfun
+
let &cpo= s:keepcpo
unlet s:keepcpo
" ------------------------------------------------------------------------