diff options
author | Bram Moolenaar <Bram@vim.org> | 2017-12-14 19:56:46 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2017-12-14 19:56:46 +0100 |
commit | 4697399e8c805325009351a2488e3da530d0af38 (patch) | |
tree | 8269688242f4499138dfb19e13e455cf1b7028b4 /runtime | |
parent | 7f88b65f6cde3d69386e461f61271a271b79b7e8 (diff) |
move netrw back to the previous version
Diffstat (limited to 'runtime')
-rw-r--r-- | runtime/autoload/netrw.vim | 1372 | ||||
-rw-r--r-- | runtime/autoload/netrwSettings.vim | 10 | ||||
-rw-r--r-- | runtime/plugin/netrwPlugin.vim | 14 |
3 files changed, 556 insertions, 840 deletions
diff --git a/runtime/autoload/netrw.vim b/runtime/autoload/netrw.vim index 1676155445..de85844d5d 100644 --- a/runtime/autoload/netrw.vim +++ b/runtime/autoload/netrw.vim @@ -1,7 +1,7 @@ " netrw.vim: Handles file transfer and remote directory listing across " AUTOLOAD SECTION -" Date: Nov 03, 2017 -" Version: 162 +" Date: Apr 20, 2016 +" Version: 156 " Maintainer: Charles E Campbell <NdrOchip@ScampbellPfamily.AbizM-NOSPAM> " GetLatestVimScripts: 1075 1 :AutoInstall: netrw.vim " Copyright: Copyright (C) 2016 Charles E. Campbell {{{1 @@ -22,24 +22,15 @@ if &cp || exists("g:loaded_netrw") finish endif - -" Check that vim has patches that netrw requires. -" Patches needed: 1557, and 213. -" (netrw will benefit from vim's having patch#656, too) -let s:needspatches=[1557,213] -if exists("s:needspatches") - for ptch in s:needspatches - if v:version < 704 || (v:version == 704 && !has("patch".ptch)) - if !exists("s:needpatch{ptch}") - unsilent echomsg "***sorry*** this version of netrw requires vim v7.4 with patch#".ptch - endif - let s:needpatch{ptch}= 1 - finish - endif - endfor +" netrw requires vim having patch 213; netrw will benefit from vim's having patch#656, too +if v:version < 704 || !has("patch213") + if !exists("s:needpatch213") + unsilent echomsg "***sorry*** this version of netrw requires vim v7.4 with patch 213" + endif + let s:needpatch213= 1 + finish endif - -let g:loaded_netrw = "v162" +let g:loaded_netrw = "v156" if !exists("s:NOTE") let s:NOTE = 0 let s:WARNING = 1 @@ -64,7 +55,7 @@ setl cpo&vim " Usage: netrw#ErrorMsg(s:NOTE | s:WARNING | s:ERROR,"some message",error-number) " netrw#ErrorMsg(s:NOTE | s:WARNING | s:ERROR,["message1","message2",...],error-number) " (this function can optionally take a list of messages) -" Mar 21, 2017 : max errnum currently is 105 +" Jan 19, 2016 : max errnum currently is 103 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) @@ -190,14 +181,6 @@ if !exists("s:LONGLIST") endif " --------------------------------------------------------------------- -" Default option values: {{{2 -let g:netrw_localcopycmdopt = "" -let g:netrw_localcopydircmdopt = "" -let g:netrw_localmkdiropt = "" -let g:netrw_localmovecmdopt = "" -let g:netrw_localrmdiropt = "" - -" --------------------------------------------------------------------- " Default values for netrw's global protocol variables {{{2 call s:NetrwInit("g:netrw_use_errorwindow",1) @@ -232,21 +215,21 @@ if !exists("g:netrw_ftp_options") let g:netrw_ftp_options= "-i -n" endif if !exists("g:netrw_http_cmd") - if executable("curl") + if executable("elinks") + let g:netrw_http_cmd = "elinks" + call s:NetrwInit("g:netrw_http_xcmd","-source >") + elseif executable("links") + let g:netrw_http_cmd = "links" + call s:NetrwInit("g:netrw_http_xcmd","-source >") + elseif executable("curl") let g:netrw_http_cmd = "curl" - call s:NetrwInit("g:netrw_http_xcmd","-L -o") + call s:NetrwInit("g:netrw_http_xcmd","-o") elseif executable("wget") let g:netrw_http_cmd = "wget" call s:NetrwInit("g:netrw_http_xcmd","-q -O") - elseif executable("elinks") - let g:netrw_http_cmd = "elinks" - call s:NetrwInit("g:netrw_http_xcmd","-source >") elseif executable("fetch") let g:netrw_http_cmd = "fetch" call s:NetrwInit("g:netrw_http_xcmd","-o") - elseif executable("links") - let g:netrw_http_cmd = "links" - call s:NetrwInit("g:netrw_http_xcmd","-http.extra-header ".shellescape("Accept-Encoding: identity", 1)." -source >") else let g:netrw_http_cmd = "" endif @@ -255,7 +238,6 @@ call s:NetrwInit("g:netrw_http_put_cmd","curl -T") call s:NetrwInit("g:netrw_keepj","keepj") call s:NetrwInit("g:netrw_rcp_cmd" , "rcp") call s:NetrwInit("g:netrw_rsync_cmd", "rsync") -call s:NetrwInit("g:netrw_rsync_sep", "/") if !exists("g:netrw_scp_cmd") if executable("scp") call s:NetrwInit("g:netrw_scp_cmd" , "scp -q") @@ -382,8 +364,7 @@ if !exists("g:netrw_localcopycmd") if g:netrw_cygwin let g:netrw_localcopycmd= "cp" else - let g:netrw_localcopycmd = expand("$COMSPEC") - let g:netrw_localcopycmdopt= " /c copy" + let g:netrw_localcopycmd= expand("$COMSPEC")." /c copy" endif elseif has("unix") || has("macunix") let g:netrw_localcopycmd= "cp" @@ -394,20 +375,14 @@ endif if !exists("g:netrw_localcopydircmd") if has("win32") || has("win95") || has("win64") || has("win16") if g:netrw_cygwin - let g:netrw_localcopydircmd = "cp" - let g:netrw_localcopydircmdopt= " -R" + let g:netrw_localcopydircmd= "cp -R" else - let g:netrw_localcopydircmd = expand("$COMSPEC") - let g:netrw_localcopydircmdopt= " /c xcopy /e /c /h /i /k" - endif - elseif has("unix") - let g:netrw_localcopydircmd = "cp" - let g:netrw_localcopydircmdopt= " -R" - elseif has("macunix") - let g:netrw_localcopydircmd = "cp" - let g:netrw_localcopydircmdopt= " -R" + let g:netrw_localcopycmd= expand("$COMSPEC")." /c xcopy /e /c /h /i /k" + endif + elseif has("unix") || has("macunix") + let g:netrw_localcopydircmd= "cp -R" else - let g:netrw_localcopydircmd= "" + let g:netrw_localcopycmd= "" endif endif if exists("g:netrw_local_mkdir") @@ -418,8 +393,7 @@ if has("win32") || has("win95") || has("win64") || has("win16") if g:netrw_cygwin call s:NetrwInit("g:netrw_localmkdir","mkdir") else - let g:netrw_localmkdir = expand("$COMSPEC") - let g:netrw_localmkdiropt= " /c mkdir" + let g:netrw_localmkdir= expand("$COMSPEC")." /c mkdir" endif else call s:NetrwInit("g:netrw_localmkdir","mkdir") @@ -434,8 +408,7 @@ if !exists("g:netrw_localmovecmd") if g:netrw_cygwin let g:netrw_localmovecmd= "mv" else - let g:netrw_localmovecmd = expand("$COMSPEC") - let g:netrw_localmovecmdopt= " /c move" + let g:netrw_localmovecmd= expand("$COMSPEC")." /c move" endif elseif has("unix") || has("macunix") let g:netrw_localmovecmd= "mv" @@ -443,8 +416,7 @@ if !exists("g:netrw_localmovecmd") let g:netrw_localmovecmd= "" endif endif -if v:version < 704 || (v:version == 704 && !has("patch1107")) - " 1109 provides for delete(tmpdir,"d") which is what will be used +if v:version < 704 || !has("patch1109") if exists("g:netrw_local_rmdir") let g:netrw_localrmdir= g:netrw_local_rmdir call netrw#ErrorMsg(s:NOTE,"g:netrw_local_rmdir is deprecated in favor of g:netrw_localrmdir",86) @@ -453,8 +425,7 @@ if v:version < 704 || (v:version == 704 && !has("patch1107")) if g:netrw_cygwin call s:NetrwInit("g:netrw_localrmdir","rmdir") else - let g:netrw_localrmdir = expand("$COMSPEC") - let g:netrw_localrmdiropt= " /c rmdir" + let g:netrw_localrmdir= expand("$COMSPEC")." /c rmdir" endif else call s:NetrwInit("g:netrw_localrmdir","rmdir") @@ -556,7 +527,7 @@ if has("gui_running") && (&enc == 'utf-8' || &enc == 'utf-16' || &enc == 'ucs-4' else let s:treedepthstring= "| " endif -call s:NetrwInit("s:netrw_posn",'{}') +call s:NetrwInit("s:netrw_nbcd",'{}') " BufEnter event ignored by decho when following variable is true " Has a side effect that doau BufReadPost doesn't work, so @@ -917,7 +888,7 @@ fun! netrw#Explore(indx,dosplit,style,...) NetrwKeepj call netrw#ErrorMsg(s:WARNING,"using Nexplore or <s-down> improperly; see help for netrw-starstar",40) if has("clipboard") sil! let @* = keepregstar - sil! let @+ = keepregplus + sil! let @+ = keepregstar endif sil! let @/ = keepregslash " call Dret("netrw#Explore") @@ -942,7 +913,7 @@ fun! netrw#Explore(indx,dosplit,style,...) NetrwKeepj call netrw#ErrorMsg(s:WARNING,"using Pexplore or <s-up> improperly; see help for netrw-starstar",41) if has("clipboard") sil! let @* = keepregstar - sil! let @+ = keepregplus + sil! let @+ = keepregstar endif sil! let @/ = keepregslash " call Dret("netrw#Explore") @@ -996,8 +967,8 @@ fun! netrw#Explore(indx,dosplit,style,...) keepalt call netrw#ErrorMsg(s:WARNING,'no files matched pattern<'.pattern.'>',45) if &hls | let keepregslash= s:ExplorePatHls(pattern) | endif if has("clipboard") - sil! let @* = keepregstar - sil! let @+ = keepregplus + sil! let @* = keepregstar + sil! let @+ = keepregstar endif sil! let @/ = keepregslash " call Dret("netrw#Explore : no files matched pattern") @@ -1033,7 +1004,7 @@ fun! netrw#Explore(indx,dosplit,style,...) keepalt NetrwKeepj call netrw#ErrorMsg(s:WARNING,"no files matched",42) if has("clipboard") sil! let @* = keepregstar - sil! let @+ = keepregplus + sil! let @+ = keepregstar endif sil! let @/ = keepregslash " call Dret("netrw#Explore : no files matched") @@ -1081,7 +1052,7 @@ fun! netrw#Explore(indx,dosplit,style,...) endif if has("clipboard") sil! let @* = keepregstar - sil! let @+ = keepregplus + sil! let @+ = keepregstar endif sil! let @/ = keepregslash " call Dret("netrw#Explore : missing +path_extra") @@ -1135,9 +1106,7 @@ fun! netrw#Explore(indx,dosplit,style,...) let prvfname= fname endfor " call Decho("explore_match<".s:explore_match.">",'~'.expand("<slnum>")) - if has("syntax") && exists("g:syntax_on") && g:syntax_on - exe "2match netrwMarkFile /".s:explore_match."/" - endif + exe "2match netrwMarkFile /".s:explore_match."/" endif echo "<s-up>==Pexplore <s-down>==Nexplore" else @@ -1154,7 +1123,7 @@ fun! netrw#Explore(indx,dosplit,style,...) let s:netrw_events= 2 if has("clipboard") sil! let @* = keepregstar - sil! let @+ = keepregplus + sil! let @+ = keepregstar endif sil! let @/ = keepregslash " call Dret("netrw#Explore : @/<".@/.">") @@ -1163,14 +1132,13 @@ endfun " --------------------------------------------------------------------- " netrw#Lexplore: toggle Explorer window, keeping it on the left of the current tab {{{2 fun! netrw#Lexplore(count,rightside,...) -" call Dfunc("netrw#Lexplore(count=".a:count." rightside=".a:rightside.",...) a:0=".a:0." ft=".&ft) +" call Dfunc("netrw#Lexplore(count=".a:count."rightside=".a:rightside.",...) a:0=".a:0." ft=".&ft) let curwin= winnr() if a:0 > 0 && a:1 != "" " if a netrw window is already on the left-side of the tab " and a directory has been specified, explore with that " directory. -" call Decho("case has input argument(s) (a:1<".a:1.">)") let a1 = expand(a:1) " call Decho("a:1<".a:1."> curwin#".curwin,'~'.expand("<slnum>")) exe "1wincmd w" @@ -1188,22 +1156,18 @@ fun! netrw#Lexplore(count,rightside,...) exe curwin."wincmd w" else let a1= "" -" call Decho("no input arguments") endif if exists("t:netrw_lexbufnr") " check if t:netrw_lexbufnr refers to a netrw window let lexwinnr = bufwinnr(t:netrw_lexbufnr) -" call Decho("lexwinnr= bufwinnr(t:netrw_lexbufnr#".t:netrw_lexbufnr.")=".lexwinnr) else let lexwinnr= 0 -" call Decho("t:netrw_lexbufnr doesn't exist") endif -" call Decho("lexwinnr=".lexwinnr,'~'.expand("<slnum>")) if lexwinnr > 0 " close down netrw explorer window -" call Decho("t:netrw_lexbufnr#".t:netrw_lexbufnr.": close down netrw window",'~'.expand("<slnum>")) +" call Decho("t:netrw_lexbufnr#".t:netrw_lexbufnr.": close down netrw window",'~'.expand("<slnum>")) exe lexwinnr."wincmd w" let g:netrw_winsize = -winwidth(0) let t:netrw_lexposn = winsaveview() @@ -1213,11 +1177,8 @@ fun! netrw#Lexplore(count,rightside,...) if lexwinnr < curwin let curwin= curwin - 1 endif - if lexwinnr != curwin - exe curwin."wincmd w" - endif + exe curwin."wincmd w" unlet t:netrw_lexbufnr -" call Decho("unlet t:netrw_lexbufnr") else " open netrw explorer window @@ -1232,17 +1193,15 @@ fun! netrw#Lexplore(count,rightside,...) let curfile= expand("%") " call Decho("curfile<".curfile.">",'~'.expand("<slnum>")) exe (a:rightside? "botright" : "topleft")." vertical ".((g:netrw_winsize > 0)? (g:netrw_winsize*winwidth(0))/100 : -g:netrw_winsize) . " new" -" call Decho("new buf#".bufnr("%")." win#".winnr()) if a:0 > 0 && a1 != "" " call Decho("case 1: Explore ".a1,'~'.expand("<slnum>")) - call netrw#Explore(0,0,0,a1) exe "Explore ".fnameescape(a1) elseif curfile =~ '^\a\{3,}://' " call Decho("case 2: Explore ".substitute(curfile,'[^/\\]*$','',''),'~'.expand("<slnum>")) - call netrw#Explore(0,0,0,substitute(curfile,'[^/\\]*$','','')) + exe "Explore ".substitute(curfile,'[^/\\]*$','','') else " call Decho("case 3: Explore .",'~'.expand("<slnum>")) - call netrw#Explore(0,0,0,".") + Explore . endif if a:count != 0 let g:netrw_winsize = netrw_winsize @@ -1250,8 +1209,6 @@ fun! netrw#Lexplore(count,rightside,...) setlocal winfixwidth let g:netrw_altv = keep_altv let t:netrw_lexbufnr = bufnr("%") -" call Decho("let t:netrw_lexbufnr=".t:netrw_lexbufnr) -" call Decho("t:netrw_lexposn".(exists("t:netrw_lexposn")? string(t:netrw_lexposn) : " n/a")) if exists("t:netrw_lexposn") " call Decho("restoring to t:netrw_lexposn",'~'.expand("<slnum>")) " call Decho("restoring posn to t:netrw_lexposn<".string(t:netrw_lexposn).">",'~'.expand("<slnum>")) @@ -1267,7 +1224,6 @@ fun! netrw#Lexplore(count,rightside,...) else let g:netrw_chgwin= 2 endif -" call Decho("let g:netrw_chgwin=".g:netrw_chgwin) endif " call Dret("netrw#Lexplore") @@ -1385,7 +1341,7 @@ fun! netrw#Obtain(islocal,fname,...) " call Decho("transfer files one at a time",'~'.expand("<slnum>")) for fname in fnamelist " call Decho("system(".g:netrw_localcopycmd." ".s:ShellEscape(fname)." ".s:ShellEscape(topath).")",'~'.expand("<slnum>")) - call system(g:netrw_localcopycmd.g:netrw_localcopycmdopt." ".s:ShellEscape(fname)." ".s:ShellEscape(topath)) + call system(g:netrw_localcopycmd." ".s:ShellEscape(fname)." ".s:ShellEscape(topath)) if v:shell_error != 0 call netrw#ErrorMsg(s:WARNING,"consider setting g:netrw_localcopycmd<".g:netrw_localcopycmd."> to something that works",80) " call Dret("s:NetrwObtain 0 : failed: ".g:netrw_localcopycmd." ".s:ShellEscape(fname)." ".s:ShellEscape(topath)) @@ -1397,7 +1353,7 @@ fun! netrw#Obtain(islocal,fname,...) " call Decho("transfer files with one command",'~'.expand("<slnum>")) let filelist= join(map(deepcopy(fnamelist),"s:ShellEscape(v:val)")) " call Decho("system(".g:netrw_localcopycmd." ".filelist." ".s:ShellEscape(topath).")",'~'.expand("<slnum>")) - call system(g:netrw_localcopycmd.g:netrw_localcopycmdopt." ".filelist." ".s:ShellEscape(topath)) + call system(g:netrw_localcopycmd." ".filelist." ".s:ShellEscape(topath)) if v:shell_error != 0 call netrw#ErrorMsg(s:WARNING,"consider setting g:netrw_localcopycmd<".g:netrw_localcopycmd."> to something that works",80) " call Dret("s:NetrwObtain 0 : failed: ".g:netrw_localcopycmd." ".filelist." ".s:ShellEscape(topath)) @@ -1431,7 +1387,7 @@ fun! netrw#Obtain(islocal,fname,...) else let path= "" endif - let filelist= join(map(deepcopy(fnamelist),'escape(s:ShellEscape(g:netrw_machine.":".path.v:val,1)," ")')) + let filelist= join(map(deepcopy(fnamelist),'s:ShellEscape(g:netrw_machine.":".path.v:val,1)')) call s:NetrwExe(s:netrw_silentxfer."!".g:netrw_scp_cmd.s:ShellEscape(useport,1)." ".filelist." ".s:ShellEscape(tgtdir,1)) elseif b:netrw_method == 2 @@ -1606,6 +1562,7 @@ fun! s:NetrwOptionRestore(vt) " call Dfunc("s:NetrwOptionRestore(vt<".a:vt.">) win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> winnr($)=".winnr("$")) " call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo." a:vt=".a:vt,'~'.expand("<slnum>")) if !exists("{a:vt}netrw_optionsave") + call s:RestorePosn(s:netrw_nbcd) " call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo." a:vt=".a:vt,'~'.expand("<slnum>")) " call Decho("ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)",'~'.expand("<slnum>")) " call Dret("s:NetrwOptionRestore : ".a:vt."netrw_optionsave doesn't exist") @@ -1624,45 +1581,47 @@ fun! s:NetrwOptionRestore(vt) endif endif endif - call s:NetrwRestoreSetting(a:vt."netrw_aikeep","&l:ai") - call s:NetrwRestoreSetting(a:vt."netrw_awkeep","&l:aw") - call s:NetrwRestoreSetting(a:vt."netrw_blkeep","&l:bl") - call s:NetrwRestoreSetting(a:vt."netrw_btkeep","&l:bt") - call s:NetrwRestoreSetting(a:vt."netrw_bombkeep","&l:bomb") - call s:NetrwRestoreSetting(a:vt."netrw_cedit","&cedit") - call s:NetrwRestoreSetting(a:vt."netrw_cikeep","&l:ci") - call s:NetrwRestoreSetting(a:vt."netrw_cinkeep","&l:cin") - call s:NetrwRestoreSetting(a:vt."netrw_cinokeep","&l:cino") - call s:NetrwRestoreSetting(a:vt."netrw_comkeep","&l:com") - call s:NetrwRestoreSetting(a:vt."netrw_cpokeep","&l:cpo") - call s:NetrwRestoreSetting(a:vt."netrw_diffkeep","&l:diff") - call s:NetrwRestoreSetting(a:vt."netrw_fenkeep","&l:fen") - if exists("g:netrw_ffkeep") && g:netrw_ffkeep - call s:NetrwRestoreSetting(a:vt."netrw_ffkeep")","&l:ff") - endif - call s:NetrwRestoreSetting(a:vt."netrw_fokeep","&l:fo") - call s:NetrwRestoreSetting(a:vt."netrw_gdkeep","&l:gd") - call s:NetrwRestoreSetting(a:vt."netrw_hidkeep","&l:hidden") - call s:NetrwRestoreSetting(a:vt."netrw_imkeep","&l:im") - call s:NetrwRestoreSetting(a:vt."netrw_iskkeep","&l:isk") - call s:NetrwRestoreSetting(a:vt."netrw_lskeep","&l:ls") - call s:NetrwRestoreSetting(a:vt."netrw_makeep","&l:ma") - call s:NetrwRestoreSetting(a:vt."netrw_magickeep","&l:magic") - call s:NetrwRestoreSetting(a:vt."netrw_modkeep","&l:mod") - call s:NetrwRestoreSetting(a:vt."netrw_nukeep","&l:nu") - call s:NetrwRestoreSetting(a:vt."netrw_rnukeep","&l:rnu") - call s:NetrwRestoreSetting(a:vt."netrw_repkeep","&l:report") - call s:NetrwRestoreSetting(a:vt."netrw_rokeep","&l:ro") - call s:NetrwRestoreSetting(a:vt."netrw_selkeep","&l:sel") - call s:NetrwRestoreSetting(a:vt."netrw_spellkeep","&l:spell") - call s:NetrwRestoreSetting(a:vt."netrw_twkeep","&l:tw") - call s:NetrwRestoreSetting(a:vt."netrw_wigkeep","&l:wig") - call s:NetrwRestoreSetting(a:vt."netrw_wrapkeep","&l:wrap") - call s:NetrwRestoreSetting(a:vt."netrw_writekeep","&l:write") - call s:NetrwRestoreSetting("s:yykeep","@@") + if exists("{a:vt}netrw_aikeep") |let &l:ai = {a:vt}netrw_aikeep |unlet {a:vt}netrw_aikeep |endif + if exists("{a:vt}netrw_awkeep") |let &l:aw = {a:vt}netrw_awkeep |unlet {a:vt}netrw_awkeep |endif + if exists("{a:vt}netrw_blkeep") |let &l:bl = {a:vt}netrw_blkeep |unlet {a:vt}netrw_blkeep |endif + if exists("{a:vt}netrw_btkeep") |let &l:bt = {a:vt}netrw_btkeep |unlet {a:vt}netrw_btkeep |endif + if exists("{a:vt}netrw_bombkeep") |let &l:bomb = {a:vt}netrw_bombkeep |unlet {a:vt}netrw_bombkeep |endif + if exists("{a:vt}netrw_cedit") |let &cedit = {a:vt}netrw_cedit |unlet {a:vt}netrw_cedit |endif + if exists("{a:vt}netrw_cikeep") |let &l:ci = {a:vt}netrw_cikeep |unlet {a:vt}netrw_cikeep |endif + if exists("{a:vt}netrw_cinkeep") |let &l:cin = {a:vt}netrw_cinkeep |unlet {a:vt}netrw_cinkeep |endif + if exists("{a:vt}netrw_cinokeep") |let &l:cino = {a:vt}netrw_cinokeep |unlet {a:vt}netrw_cinokeep |endif + if exists("{a:vt}netrw_comkeep") |let &l:com = {a:vt}netrw_comkeep |unlet {a:vt}netrw_comkeep |endif + if exists("{a:vt}netrw_cpokeep") |let &l:cpo = {a:vt}netrw_cpokeep |unlet {a:vt}netrw_cpokeep |endif + if exists("{a:vt}netrw_diffkeep") |let &l:diff = {a:vt}netrw_diffkeep |unlet {a:vt}netrw_diffkeep |endif + if exists("{a:vt}netrw_fenkeep") |let &l:fen = {a:vt}netrw_fenkeep |unlet {a:vt}netrw_fenkeep |endif + if exists("g:netrw_ffkep") && g:netrw_ffkeep + if exists("{a:vt}netrw_ffkeep") |let &l:ff = {a:vt}netrw_ffkeep |unlet {a:vt}netrw_ffkeep |endif + endif + if exists("{a:vt}netrw_fokeep") |let &l:fo = {a:vt}netrw_fokeep |unlet {a:vt}netrw_fokeep |endif + if exists("{a:vt}netrw_gdkeep") |let &l:gd = {a:vt}netrw_gdkeep |unlet {a:vt}netrw_gdkeep |endif + if exists("{a:vt}netrw_hidkeep") |let &l:hidden = {a:vt}netrw_hidkeep |unlet {a:vt}netrw_hidkeep |endif + if exists("{a:vt}netrw_imkeep") |let &l:im = {a:vt}netrw_imkeep |unlet {a:vt}netrw_imkeep |endif + if exists("{a:vt}netrw_iskkeep") |let &l:isk = {a:vt}netrw_iskkeep |unlet {a:vt}netrw_iskkeep |endif + if exists("{a:vt}netrw_lskeep") |let &l:ls = {a:vt}netrw_lskeep |unlet {a:vt}netrw_lskeep |endif + if exists("{a:vt}netrw_makeep") |let &l:ma = {a:vt}netrw_makeep |unlet {a:vt}netrw_makeep |endif + if exists("{a:vt}netrw_magickeep")|let &l:magic = {a:vt}netrw_magickeep |unlet {a:vt}netrw_magickeep|endif + if exists("{a:vt}netrw_modkeep") |let &l:mod = {a:vt}netrw_modkeep |unlet {a:vt}netrw_modkeep |endif + if exists("{a:vt}netrw_nukeep") |let &l:nu = {a:vt}netrw_nukeep |unlet {a:vt}netrw_nukeep |endif + if exists("{a:vt}netrw_rnukeep") |let &l:rnu = {a:vt}netrw_rnukeep |unlet {a:vt}netrw_rnukeep |endif + if exists("{a:vt}netrw_repkeep") |let &l:report = {a:vt}netrw_repkeep |unlet {a:vt}netrw_repkeep |endif + if exists("{a:vt}netrw_rokeep") |let &l:ro = {a:vt}netrw_rokeep |unlet {a:vt}netrw_rokeep |endif + if exists("{a:vt}netrw_selkeep") |let &l:sel = {a:vt}netrw_selkeep |unlet {a:vt}netrw_selkeep |endif + if exists("{a:vt}netrw_spellkeep")|let &l:spell = {a:vt}netrw_spellkeep |unlet {a:vt}netrw_spellkeep|endif + if has("clipboard") + if exists("{a:vt}netrw_starkeep") |let @* = {a:vt}netrw_starkeep |unlet {a:vt}netrw_starkeep |endif + endif " Problem: start with liststyle=0; press <i> : result, following line resets l:ts. - call s:NetrwRestoreSetting(a:vt."netrw_tskeep","&l:ts") - +" if exists("{a:vt}netrw_tskeep") |let &l:ts = {a:vt}netrw_tskeep |unlet {a:vt}netrw_tskeep |endif + if exists("{a:vt}netrw_twkeep") |let &l:tw = {a:vt}netrw_twkeep |unlet {a:vt}netrw_twkeep |endif + if exists("{a:vt}netrw_wigkeep") |let &l:wig = {a:vt}netrw_wigkeep |unlet {a:vt}netrw_wigkeep |endif + if exists("{a:vt}netrw_wrapkeep") |let &l:wrap = {a:vt}netrw_wrapkeep |unlet {a:vt}netrw_wrapkeep |endif + if exists("{a:vt}netrw_writekeep")|let &l:write = {a:vt}netrw_writekeep |unlet {a:vt}netrw_writekeep|endif + if exists("s:yykeep") |let @@ = s:yykeep |unlet s:yykeep |endif if exists("{a:vt}netrw_swfkeep") if &directory == "" " user hasn't specified a swapfile directory; @@ -1688,10 +1647,10 @@ fun! s:NetrwOptionRestore(vt) endif endif if has("clipboard") - call s:NetrwRestoreSetting(a:vt."netrw_starkeep","@*") - call s:NetrwRestoreSetting(a:vt."netrw_pluskeep","@+") + if exists("{a:vt}netrw_regstar") |sil! let @*= {a:vt}netrw_regstar |unlet {a:vt}netrw_regstar |endif endif - call s:NetrwRestoreSetting(a:vt."netrw_slashkeep","@/") + if exists("{a:vt}netrw_regslash")|sil! let @/= {a:vt}netrw_regslash|unlet {a:vt}netrw_regslash|endif + call s:RestorePosn(s:netrw_nbcd) " call Decho("g:netrw_keepdir=".g:netrw_keepdir.": getcwd<".getcwd()."> acd=".&acd,'~'.expand("<slnum>")) " call Decho("fo=".&fo.(exists("+acd")? " acd=".&acd : " acd doesn't exist"),'~'.expand("<slnum>")) @@ -1769,6 +1728,9 @@ fun! s:NetrwOptionSave(vt) if !g:netrw_use_noswf let {a:vt}netrw_swfkeep = &l:swf endif + if has("clipboard") + let {a:vt}netrw_starkeep = @* + endif let {a:vt}netrw_tskeep = &l:ts let {a:vt}netrw_twkeep = &l:tw " textwidth let {a:vt}netrw_wigkeep = &l:wig " wildignore @@ -1781,54 +1743,15 @@ fun! s:NetrwOptionSave(vt) let {a:vt}netrw_dirkeep = getcwd() endif if has("clipboard") - sil! let {a:vt}netrw_starkeep = @* - sil! let {a:vt}netrw_pluskeep = @+ + if &go =~# 'a' | sil! let {a:vt}netrw_regstar = @* | endif endif - sil! let {a:vt}netrw_slashkeep= @/ + sil! let {a:vt}netrw_regslash= @/ " call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo." a:vt=".a:vt,'~'.expand("<slnum>")) " call Dret("s:NetrwOptionSave : tab#".tabpagenr()." win#".winnr()) endfun " ------------------------------------------------------------------------ -" s:NetrwRestoreSetting: restores specified setting using associated keepvar, {{{2 -" but only if the setting value differs from the associated keepvar. -" Doing this means that netrw will not come up as having changed a -" setting last when it really didn't actually change it. -" Used by s:NetrwOptionRestore() to restore each netrw-senstive setting -" and by s:NetrwSafeOptions() -fun! s:NetrwRestoreSetting(keepvar,setting) -" call Dfunc("s:NetrwRestoreSetting(keepvar<".a:keepvar."> setting<".a:setting.">)") - - if a:keepvar =~ '^&' - exe "let keepvarval= ".a:keepvar - if keepvarval != a:setting - if type(a:setting) == 0 - exe "let ".a:keepvar."=".a:setting - elseif type(a:setting) == 1 - exe "let ".a:keepvar."= '".a:setting."'" - else - call netrw#ErrorMsg(s:ERROR,"(s:NetrwRestoreSetting) doesn't know how to restore ".a:keepvar." with a setting of type#".type(a:setting),105) - endif - endif - - elseif exists(a:keepvar) - exe "let keepvarval= '".a:keepvar."'" - if keepvarval != a:setting - if type(a:setting) == 0 - exe "let ".a:keepvar."= ".a:setting - elseif type(a:setting) == 1 - exe "let ".a:keepvar."= '".a:setting."'" - else - call netrw#ErrorMsg(s:ERROR,"(s:NetrwRestoreSetting) doesn't know how to restore ".a:keepvar." with a setting of type#".type(a:setting),105) - endif - endif - exe "unlet ".a:keepvar - endif -" call Dret("s:NetrwRestoreSetting") -endfun - -" --------------------------------------------------------------------- " s:NetrwSafeOptions: sets options to help netrw do its job {{{2 " Use s:NetrwSaveOptions() to save user settings " Use s:NetrwOptionRestore() to restore user settings @@ -1836,32 +1759,32 @@ fun! s:NetrwSafeOptions() " call Dfunc("s:NetrwSafeOptions() win#".winnr()." buf#".bufnr("%")."<".bufname(bufnr("%"))."> winnr($)=".winnr("$")) " call Decho("win#".winnr()."'s ft=".&ft,'~'.expand("<slnum>")) " call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo,'~'.expand("<slnum>")) - if exists("+acd") | call s:NetrwRestoreSetting("&l:acd",0)|endif - call s:NetrwRestoreSetting("&l:ai",0) - call s:NetrwRestoreSetting("&l:aw",0) - call s:NetrwRestoreSetting("&l:bl",0) - call s:NetrwRestoreSetting("&l:bomb",0) - call s:NetrwRestoreSetting("&l:bt","nofile") - call s:NetrwRestoreSetting("&l:ci",0) - call s:NetrwRestoreSetting("&l:cin",0) - call s:NetrwRestoreSetting("&l:bh","hide") - call s:NetrwRestoreSetting("&l:cino","") - call s:NetrwRestoreSetting("&l:com","") - if &cpo =~ 'a' | call s:NetrwRestoreSetting("&cpo",substitute(&cpo,'a','','g')) | endif - if &cpo =~ 'A' | call s:NetrwRestoreSetting("&cpo",substitute(&cpo,'A','','g')) | endif + if exists("+acd") | setl noacd | endif + setl noai + setl noaw + setl nobl + setl nobomb + setl bt=nofile + setl noci + setl nocin + setl bh=hide + setl cino= + setl com= + setl cpo-=a + setl cpo-=A setl fo=nroql2 - call s:NetrwRestoreSetting("&l:hid",0) - call s:NetrwRestoreSetting("&l:im",0) + setl nohid + setl noim setl isk+=@ isk+=* isk+=/ - call s:NetrwRestoreSetting("&l:magic",1) + setl magic if g:netrw_use_noswf - call s:NetrwRestoreSetting("swf",0) + setl noswf endif - call s:NetrwRestoreSetting("&l:report",10000) - call s:NetrwRestoreSetting("&l:sel","inclusive") - call s:NetrwRestoreSetting("&l:spell",0) - call s:NetrwRestoreSetting("&l:tw",0) - call s:NetrwRestoreSetting("&l:wig","") + setl report=10000 + setl sel=inclusive + setl nospell + setl tw=0 + setl wig= setl cedit& call s:NetrwCursor() @@ -1869,7 +1792,7 @@ fun! s:NetrwSafeOptions() " call Decho("ft<".&ft."> ei=".&ei,'~'.expand("<slnum>")) if &ft == "netrw" " call Decho("do any netrw FileType autocmds (doau FileType netrw)",'~'.expand("<slnum>")) - keepalt NetrwKeepj doau FileType netrw + sil! keepalt NetrwKeepj doau FileType netrw endif " call Decho("fo=".&fo.(exists("+acd")? " acd=".&acd : " acd doesn't exist")." bh=".&l:bh." bt<".&bt.">",'~'.expand("<slnum>")) @@ -1910,7 +1833,7 @@ fun! NetrwStatusLine() endif endfun -" =============================== +" --------------------------------------------------------------------- " Netrw Transfer Functions: {{{1 " =============================== @@ -2020,7 +1943,7 @@ fun! netrw#NetRead(mode,...) " NetRead: Determine method of read (ftp, rcp, etc) {{{3 call s:NetrwMethod(choice) if !exists("b:netrw_method") || b:netrw_method < 0 -" call Dret("netrw#NetRead : unsupported method") +" call Dfunc("netrw#NetRead : unsupported method") return endif let tmpfile= s:GetTempfile(b:netrw_fname) " apply correct suffix @@ -2180,7 +2103,7 @@ fun! netrw#NetRead(mode,...) else let tmpfile_get = tmpfile endif - call s:NetrwExe(s:netrw_silentxfer."!".g:netrw_scp_cmd.useport." ".escape(s:ShellEscape(g:netrw_machine.":".b:netrw_fname,1),' ')." ".s:ShellEscape(tmpfile_get,1)) + call s:NetrwExe(s:netrw_silentxfer."!".g:netrw_scp_cmd.useport." ".s:ShellEscape(g:netrw_machine.":".b:netrw_fname,1)." ".s:ShellEscape(tmpfile_get,1)) let result = s:NetrwGetFile(readcmd, tmpfile, b:netrw_method) let b:netrw_lastfile = choice @@ -2262,7 +2185,7 @@ fun! netrw#NetRead(mode,...) " NetRead: (rsync) NetRead Method #7 {{{3 elseif b:netrw_method == 7 " call Decho("read via rsync (method #7)",'~'.expand("<slnum>")) - call s:NetrwExe(s:netrw_silentxfer."!".g:netrw_rsync_cmd." ".s:ShellEscape(g:netrw_machine.g:netrw_rsync_sep.b:netrw_fname,1)." ".s:ShellEscape(tmpfile,1)) + call s:NetrwExe(s:netrw_silentxfer."!".g:netrw_rsync_cmd." ".s:ShellEscape(g:netrw_machine.":".b:netrw_fname,1)." ".s:ShellEscape(tmpfile,1)) let result = s:NetrwGetFile(readcmd,tmpfile, b:netrw_method) let b:netrw_lastfile = choice @@ -2604,7 +2527,7 @@ fun! netrw#NetWrite(...) range let url= g:netrw_choice call s:NetrwExe(s:netrw_silentxfer."!".g:netrw_http_put_cmd." ".s:ShellEscape(tmpfile,1)." ".s:ShellEscape(url,1) ) elseif !exists("g:netrw_quiet") - call netrw#ErrorMsg(s:ERROR,"can't write to http using <".g:netrw_http_put_cmd.">".",16) + call netrw#ErrorMsg(s:ERROR,"can't write to http using <".g:netrw_http_put_cmd".">".",16) endif "......................................... @@ -2648,7 +2571,7 @@ fun! netrw#NetWrite(...) range " NetWrite: (rsync) NetWrite Method #7 {{{3 elseif b:netrw_method == 7 " call Decho("write via rsync (method #7)",'~'.expand("<slnum>")) - call s:NetrwExe(s:netrw_silentxfer."!".g:netrw_rsync_cmd." ".s:ShellEscape(tmpfile,1)." ".s:ShellEscape(g:netrw_machine.g:netrw_rsync_sep.b:netrw_fname,1)) + call s:NetrwExe(s:netrw_silentxfer."!".g:netrw_rsync_cmd." ".s:ShellEscape(tmpfile,1)." ".s:ShellEscape(g:netrw_machine.":".b:netrw_fname,1)) let b:netrw_lastfile = choice "......................................... @@ -2753,13 +2676,9 @@ endfun " --------------------------------------------------------------------- " netrw#SetTreetop: resets the tree top to the current directory/specified directory {{{2 " (implements the :Ntree command) -fun! netrw#SetTreetop(iscmd,...) -" call Dfunc("netrw#SetTreetop(iscmd=".a:iscmd." ".((a:0 > 0)? a:1 : "").") a:0=".a:0) -" call Decho("w:netrw_treetop<".w:netrw_treetop.">") +fun! netrw#SetTreetop(...) +" call Dfunc("netrw#SetTreetop(".((a:0 > 0)? a:1 : "").") a:0=".a:0) - " iscmd==0: netrw#SetTreetop called using gn mapping - " iscmd==1: netrw#SetTreetop called using :Ntree from the command line -" call Decho("(iscmd=".a:iscmd.": called using :Ntree from command line",'~'.expand("<slnum>")) " clear out the current tree if exists("w:netrw_treetop") " call Decho("clearing out current tree",'~'.expand("<slnum>")) @@ -2770,9 +2689,8 @@ fun! netrw#SetTreetop(iscmd,...) " call Decho("freeing w:netrw_treedict",'~'.expand("<slnum>")) unlet w:netrw_treedict endif -" call Decho("inittreetop<".(exists("inittreetop")? inittreetop : "n/a").">") - if (a:iscmd == 0 || a:1 == "") && exists("inittreetop") + if a:1 == "" && exists("inittreetop") let treedir= s:NetrwTreePath(inittreetop) " call Decho("treedir<".treedir.">",'~'.expand("<slnum>")) else @@ -2781,7 +2699,7 @@ fun! netrw#SetTreetop(iscmd,...) let treedir= a:1 elseif exists("b:netrw_curdir") && (isdirectory(s:NetrwFile(b:netrw_curdir."/".a:1)) || a:1 =~ '^\a\{3,}://') let treedir= b:netrw_curdir."/".a:1 -" call Decho("a:1<".a:1."> is NOT a directory, using treedir<".treedir.">",'~'.expand("<slnum>")) +" call Decho("a:1<".a:1."> is NOT a directory, trying treedir<".treedir.">",'~'.expand("<slnum>")) else " normally the cursor is left in the message window. " However, here this results in the directory being listed in the message window, which is not wanted. @@ -2792,18 +2710,13 @@ fun! netrw#SetTreetop(iscmd,...) endif endif " call Decho("treedir<".treedir.">",'~'.expand("<slnum>")) - - " determine if treedir is remote or local let islocal= expand("%") !~ '^\a\{3,}://' " call Decho("islocal=".islocal,'~'.expand("<slnum>")) - - " browse the resulting directory if islocal call netrw#LocalBrowseCheck(s:NetrwBrowseChgDir(islocal,treedir)) else call s:NetrwBrowse(islocal,s:NetrwBrowseChgDir(islocal,treedir)) endif - " call Dret("netrw#SetTreetop") endfun @@ -2842,7 +2755,8 @@ fun! s:NetrwGetFile(readcmd, tfile, method) else let tfile= a:tfile endif - call s:NetrwBufRename(tfile) +" call Decho("exe sil! keepalt file ".fnameescape(tfile),'~'.expand("<slnum>")) + exe "sil! keepalt file ".fnameescape(tfile) " edit temporary file (ie. read the temporary file in) if rfile =~ '\.zip$' @@ -2869,7 +2783,8 @@ fun! s:NetrwGetFile(readcmd, tfile, method) endif " rename buffer back to remote filename - call s:NetrwBufRename(rfile) +" call Decho("exe sil! keepalt file ".fnameescape(rfile),'~'.expand("<slnum>")) + exe "sil! NetrwKeepj keepalt file ".fnameescape(rfile) " Detect filetype of local version of remote file. " Note that isk must not include a "/" for scripts.vim @@ -2878,7 +2793,7 @@ fun! s:NetrwGetFile(readcmd, tfile, method) let iskkeep= &l:isk setl isk-=/ let &l:isk= iskkeep -" call Dredir("ls!","NetrwGetFile (renamed buffer back to remote filename<".rfile."> : expand(%)<".expand("%").">)") +" call Dredir("renamed buffer back to remote filename<".rfile."> : expand(%)<".expand("%").">","ls!") let line1 = 1 let line2 = line("$") @@ -2949,13 +2864,13 @@ endfun " g:netrw_port = optional port number (for ftp) " g:netrw_choice = copy of input url (choice) fun! s:NetrwMethod(choice) -" call Dfunc("s:NetrwMethod(a:choice<".a:choice.">)") +" call Dfunc("NetrwMethod(a:choice<".a:choice.">)") " sanity check: choice should have at least three slashes in it if strlen(substitute(a:choice,'[^/]','','g')) < 3 call netrw#ErrorMsg(s:ERROR,"not a netrw-style url; netrw uses protocol://[user@]hostname[:port]/[path])",78) let b:netrw_method = -1 -" call Dret("s:NetrwMethod : incorrect url format<".a:choice.">") +" call Dret("NetrwMethod : incorrect url format<".a:choice.">") return endif @@ -3068,7 +2983,7 @@ fun! s:NetrwMethod(choice) endif if curmachine != g:netrw_machine - if exists("s:netrw_hup[".g:netrw_machine."]") + if exists("s:netwr_hup[".g:netrw_machine."]") call NetUserPass("ftp:".g:netrw_machine) elseif exists("s:netrw_passwd") " if there's a change in hostname, require password re-entry @@ -3198,7 +3113,7 @@ fun! s:NetrwMethod(choice) " call Decho("s:netrw_passwd <".s:netrw_passwd.">",'~'.expand("<slnum>")) " endif "Decho " call Decho("b:netrw_fname <".b:netrw_fname.">",'~'.expand("<slnum>")) -" call Dret("s:NetrwMethod : b:netrw_method=".b:netrw_method." g:netrw_port=".g:netrw_port) +" call Dret("NetrwMethod : b:netrw_method=".b:netrw_method." g:netrw_port=".g:netrw_port) endfun " ------------------------------------------------------------------------ @@ -3342,9 +3257,9 @@ fun! NetUserPass(...) " call Dret("NetUserPass : uid<".g:netrw_uid."> passwd<".s:netrw_passwd.">") endfun -" ================================= +" =========================================== " Shared Browsing Support: {{{1 -" ================================= +" =========================================== " --------------------------------------------------------------------- " s:ExplorePatHls: converts an Explore pattern into a regular expression search pattern {{{2 @@ -3647,7 +3562,7 @@ fun! s:NetrwBrowse(islocal,dirname) " call Dfunc("s:NetrwBrowse(islocal=".a:islocal." dirname<".a:dirname.">) liststyle=".w:netrw_liststyle." ".g:loaded_netrw." buf#".bufnr("%")."<".bufname("%")."> win#".winnr()) " call Decho("modified=".&modified." modifiable=".&modifiable." readonly=".&readonly,'~'.expand("<slnum>")) " call Decho("tab#".tabpagenr()." win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> line#".line(".")." col#".col(".")." winline#".winline()." wincol#".wincol(),'~'.expand("<slnum>")) -" call Dredir("ls!","s:NetrwBrowse") +" call Dredir("ls!") " save alternate-file's filename if w:netrw_rexlocal doesn't exist " This is useful when one edits a local file, then :e ., then :Rex @@ -3668,12 +3583,6 @@ fun! s:NetrwBrowse(islocal,dirname) |