summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2019-07-19 22:05:51 +0200
committerBram Moolenaar <Bram@vim.org>2019-07-19 22:05:51 +0200
commit85850f3a5ef9f5a9d22e908ef263de8faa265a95 (patch)
tree0e9b47be5b4ce7e16de3cc057588dd3507de4209
parent7964873afe59d0896a921b7c585167674bb784d5 (diff)
Update runtime files
-rw-r--r--runtime/autoload/netrw.vim1982
-rw-r--r--runtime/autoload/netrwSettings.vim10
-rw-r--r--runtime/doc/eval.txt17
-rw-r--r--runtime/doc/filetype.txt12
-rw-r--r--runtime/doc/options.txt2
-rw-r--r--runtime/doc/pi_netrw.txt94
-rw-r--r--runtime/doc/popup.txt8
-rw-r--r--runtime/doc/quickfix.txt8
-rw-r--r--runtime/doc/quickref.txt3
-rw-r--r--runtime/doc/syntax.txt3
-rw-r--r--runtime/doc/tags5
-rw-r--r--runtime/doc/todo.txt45
-rw-r--r--runtime/doc/usr_27.txt14
-rw-r--r--runtime/doc/version8.txt24
-rw-r--r--runtime/doc/windows.txt4
-rw-r--r--runtime/ftplugin/qf.vim10
-rw-r--r--runtime/lang/menu_sr_rs.utf-8.vim72
-rw-r--r--runtime/optwin.vim4
-rw-r--r--runtime/plugin/netrwPlugin.vim14
-rw-r--r--runtime/syntax/lisp.vim8
-rw-r--r--runtime/syntax/vim.vim66
-rw-r--r--runtime/tutor/README.txt2
-rw-r--r--src/po/sr.po677
23 files changed, 1797 insertions, 1287 deletions
diff --git a/runtime/autoload/netrw.vim b/runtime/autoload/netrw.vim
index 76485c2f38..a5b47e06d5 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: Apr 20, 2016
-" Version: 156
+" Date: Jul 16, 2019
+" Version: 165
" Maintainer: Charles E Campbell <NdrOchip@ScampbellPfamily.AbizM-NOSPAM>
" GetLatestVimScripts: 1075 1 :AutoInstall: netrw.vim
" Copyright: Copyright (C) 2016 Charles E. Campbell {{{1
@@ -22,15 +22,24 @@
if &cp || exists("g:loaded_netrw")
finish
endif
-" netrw requires vim having patch 7.4.213; netrw will benefit from vim's having patch#656, too
-if v:version < 704 || (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
+
+" Check that vim has patches that netrw requires.
+" Patches needed for v7.4: 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
endif
-let g:loaded_netrw = "v156"
+
+let g:loaded_netrw = "v165"
if !exists("s:NOTE")
let s:NOTE = 0
let s:WARNING = 1
@@ -39,7 +48,7 @@ endif
let s:keepcpo= &cpo
setl cpo&vim
-"let g:dechofuncname= 1
+"DechoFuncName 1
"DechoRemOn
"call Decho("doing autoload/netrw.vim version ".g:loaded_netrw,'~'.expand("<slnum>"))
@@ -55,7 +64,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)
-" Jan 19, 2016 : max errnum currently is 103
+" Mar 21, 2017 : max errnum currently is 105
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)
@@ -100,7 +109,7 @@ fun! netrw#ErrorMsg(level,msg,errnum)
" call Decho("create a NetrwMessage buffer window",'~'.expand("<slnum>"))
bo 1split
sil! call s:NetrwEnew()
- sil! NetrwKeepj call s:NetrwSafeOptions()
+ sil! NetrwKeepj call s:NetrwOptionsSafe(1)
setl bt=nofile
NetrwKeepj file NetrwMessage
" call Decho("setl ma noro",'~'.expand("<slnum>"))
@@ -171,7 +180,7 @@ endfun
" ---------------------------------------------------------------------
" Netrw Constants: {{{2
-call s:NetrwInit("g:netrw_dirhist_cnt",0)
+call s:NetrwInit("g:netrw_dirhistcnt",0)
if !exists("s:LONGLIST")
call s:NetrwInit("s:THINLIST",0)
call s:NetrwInit("s:LONGLIST",1)
@@ -181,6 +190,14 @@ 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)
@@ -215,21 +232,21 @@ if !exists("g:netrw_ftp_options")
let g:netrw_ftp_options= "-i -n"
endif
if !exists("g:netrw_http_cmd")
- 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")
+ if executable("curl")
let g:netrw_http_cmd = "curl"
- call s:NetrwInit("g:netrw_http_xcmd","-o")
+ call s:NetrwInit("g:netrw_http_xcmd","-L -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
@@ -238,6 +255,7 @@ 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")
@@ -299,7 +317,7 @@ let s:netrw_usercuc = &cursorcolumn
call s:NetrwInit("g:netrw_cygdrive","/cygdrive")
" Default values - d-g ---------- {{{3
call s:NetrwInit("s:didstarstar",0)
-call s:NetrwInit("g:netrw_dirhist_cnt" , 0)
+call s:NetrwInit("g:netrw_dirhistcnt" , 0)
call s:NetrwInit("g:netrw_decompress" , '{ ".gz" : "gunzip", ".bz2" : "bunzip2", ".zip" : "unzip", ".tar" : "tar -xf", ".xz" : "unxz" }')
call s:NetrwInit("g:netrw_dirhistmax" , 10)
call s:NetrwInit("g:netrw_errorlvl" , s:NOTE)
@@ -364,7 +382,8 @@ if !exists("g:netrw_localcopycmd")
if g:netrw_cygwin
let g:netrw_localcopycmd= "cp"
else
- let g:netrw_localcopycmd= expand("$COMSPEC")." /c copy"
+ let g:netrw_localcopycmd = expand("$COMSPEC")
+ let g:netrw_localcopycmdopt= " /c copy"
endif
elseif has("unix") || has("macunix")
let g:netrw_localcopycmd= "cp"
@@ -375,14 +394,20 @@ endif
if !exists("g:netrw_localcopydircmd")
if has("win32") || has("win95") || has("win64") || has("win16")
if g:netrw_cygwin
- let g:netrw_localcopydircmd= "cp -R"
+ let g:netrw_localcopydircmd = "cp"
+ let g:netrw_localcopydircmdopt= " -R"
else
- 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"
+ 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"
else
- let g:netrw_localcopycmd= ""
+ let g:netrw_localcopydircmd= ""
endif
endif
if exists("g:netrw_local_mkdir")
@@ -393,7 +418,8 @@ 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")." /c mkdir"
+ let g:netrw_localmkdir = expand("$COMSPEC")
+ let g:netrw_localmkdiropt= " /c mkdir"
endif
else
call s:NetrwInit("g:netrw_localmkdir","mkdir")
@@ -408,7 +434,8 @@ if !exists("g:netrw_localmovecmd")
if g:netrw_cygwin
let g:netrw_localmovecmd= "mv"
else
- let g:netrw_localmovecmd= expand("$COMSPEC")." /c move"
+ let g:netrw_localmovecmd = expand("$COMSPEC")
+ let g:netrw_localmovecmdopt= " /c move"
endif
elseif has("unix") || has("macunix")
let g:netrw_localmovecmd= "mv"
@@ -416,7 +443,8 @@ if !exists("g:netrw_localmovecmd")
let g:netrw_localmovecmd= ""
endif
endif
-if v:version < 704 || !has("patch1109")
+if v:version < 704 || (v:version == 704 && !has("patch1107"))
+ " 1109 provides for delete(tmpdir,"d") which is what will be used
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)
@@ -425,7 +453,8 @@ if v:version < 704 || !has("patch1109")
if g:netrw_cygwin
call s:NetrwInit("g:netrw_localrmdir","rmdir")
else
- let g:netrw_localrmdir= expand("$COMSPEC")." /c rmdir"
+ let g:netrw_localrmdir = expand("$COMSPEC")
+ let g:netrw_localrmdiropt= " /c rmdir"
endif
else
call s:NetrwInit("g:netrw_localrmdir","rmdir")
@@ -527,7 +556,7 @@ if has("gui_running") && (&enc == 'utf-8' || &enc == 'utf-16' || &enc == 'ucs-4'
else
let s:treedepthstring= "| "
endif
-call s:NetrwInit("s:netrw_nbcd",'{}')
+call s:NetrwInit("s:netrw_posn",'{}')
" BufEnter event ignored by decho when following variable is true
" Has a side effect that doau BufReadPost doesn't work, so
@@ -888,7 +917,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 @+ = keepregstar
+ sil! let @+ = keepregplus
endif
sil! let @/ = keepregslash
" call Dret("netrw#Explore")
@@ -913,7 +942,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 @+ = keepregstar
+ sil! let @+ = keepregplus
endif
sil! let @/ = keepregslash
" call Dret("netrw#Explore")
@@ -967,8 +996,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 @+ = keepregstar
+ sil! let @* = keepregstar
+ sil! let @+ = keepregplus
endif
sil! let @/ = keepregslash
" call Dret("netrw#Explore : no files matched pattern")
@@ -1004,7 +1033,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 @+ = keepregstar
+ sil! let @+ = keepregplus
endif
sil! let @/ = keepregslash
" call Dret("netrw#Explore : no files matched")
@@ -1052,7 +1081,7 @@ fun! netrw#Explore(indx,dosplit,style,...)
endif
if has("clipboard")
sil! let @* = keepregstar
- sil! let @+ = keepregstar
+ sil! let @+ = keepregplus
endif
sil! let @/ = keepregslash
" call Dret("netrw#Explore : missing +path_extra")
@@ -1106,7 +1135,9 @@ fun! netrw#Explore(indx,dosplit,style,...)
let prvfname= fname
endfor
" call Decho("explore_match<".s:explore_match.">",'~'.expand("<slnum>"))
- exe "2match netrwMarkFile /".s:explore_match."/"
+ if has("syntax") && exists("g:syntax_on") && g:syntax_on
+ exe "2match netrwMarkFile /".s:explore_match."/"
+ endif
endif
echo "<s-up>==Pexplore <s-down>==Nexplore"
else
@@ -1123,7 +1154,7 @@ fun! netrw#Explore(indx,dosplit,style,...)
let s:netrw_events= 2
if has("clipboard")
sil! let @* = keepregstar
- sil! let @+ = keepregstar
+ sil! let @+ = keepregplus
endif
sil! let @/ = keepregslash
" call Dret("netrw#Explore : @/<".@/.">")
@@ -1132,13 +1163,14 @@ 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"
@@ -1156,18 +1188,22 @@ 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()
@@ -1177,8 +1213,11 @@ fun! netrw#Lexplore(count,rightside,...)
if lexwinnr < curwin
let curwin= curwin - 1
endif
- exe curwin."wincmd w"
+ if lexwinnr != curwin
+ exe curwin."wincmd w"
+ endif
unlet t:netrw_lexbufnr
+" call Decho("unlet t:netrw_lexbufnr")
else
" open netrw explorer window
@@ -1193,15 +1232,17 @@ 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>"))
- exe "Explore ".substitute(curfile,'[^/\\]*$','','')
+ call netrw#Explore(0,0,0,substitute(curfile,'[^/\\]*$','',''))
else
" call Decho("case 3: Explore .",'~'.expand("<slnum>"))
- Explore .
+ call netrw#Explore(0,0,0,".")
endif
if a:count != 0
let g:netrw_winsize = netrw_winsize
@@ -1209,6 +1250,8 @@ 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>"))
@@ -1224,6 +1267,7 @@ 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")
@@ -1341,7 +1385,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." ".s:ShellEscape(fname)." ".s:ShellEscape(topath))
+ call system(g:netrw_localcopycmd.g:netrw_localcopycmdopt." ".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))
@@ -1353,7 +1397,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." ".filelist." ".s:ShellEscape(topath))
+ call system(g:netrw_localcopycmd.g:netrw_localcopycmdopt." ".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))
@@ -1387,7 +1431,7 @@ fun! netrw#Obtain(islocal,fname,...)
else
let path= ""
endif
- let filelist= join(map(deepcopy(fnamelist),'s:ShellEscape(g:netrw_machine.":".path.v:val,1)'))
+ let filelist= join(map(deepcopy(fnamelist),'escape(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
@@ -1557,134 +1601,25 @@ fun! netrw#Nread(mode,fname)
endfun
" ------------------------------------------------------------------------
-" s:NetrwOptionRestore: restore options (based on prior s:NetrwOptionSave) {{{2
-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")
- return
- endif
- unlet {a:vt}netrw_optionsave
-
- if exists("+acd")
- if exists("{a:vt}netrw_acdkeep")
-" call Decho("g:netrw_keepdir=".g:netrw_keepdir.": getcwd<".getcwd()."> acd=".&acd,'~'.expand("<slnum>"))
- let curdir = getcwd()
- let &l:acd = {a:vt}netrw_acdkeep
- unlet {a:vt}netrw_acdkeep
- if &l:acd
- call s:NetrwLcd(curdir)
- endif
- endif
- endif
- 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.
-" 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;
- " netrw will temporarily set the swapfile directory
- " to the current directory as returned by getcwd().
- let &l:directory= getcwd()
- sil! let &l:swf = {a:vt}netrw_swfkeep
- setl directory=
- unlet {a:vt}netrw_swfkeep
- elseif &l:swf != {a:vt}netrw_swfkeep
- if !g:netrw_use_noswf
- " following line causes a Press ENTER in windows -- can't seem to work around it!!!
- sil! let &l:swf= {a:vt}netrw_swfkeep
- endif
- unlet {a:vt}netrw_swfkeep
- endif
- endif
- if exists("{a:vt}netrw_dirkeep") && isdirectory(s:NetrwFile({a:vt}netrw_dirkeep)) && g:netrw_keepdir
- let dirkeep = substitute({a:vt}netrw_dirkeep,'\\','/','g')
- if exists("{a:vt}netrw_dirkeep")
- call s:NetrwLcd(dirkeep)
- unlet {a:vt}netrw_dirkeep
- endif
- endif
- if has("clipboard")
- if exists("{a:vt}netrw_regstar") |sil! let @*= {a:vt}netrw_regstar |unlet {a:vt}netrw_regstar |endif
- endif
- 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>"))
-" call Decho("ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)",'~'.expand("<slnum>"))
-" call Decho("diff=".&l:diff." win#".winnr()." w:netrw_diffkeep=".(exists("w:netrw_diffkeep")? w:netrw_diffkeep : "doesn't exist"),'~'.expand("<slnum>"))
-" call Decho("ts=".&l:ts,'~'.expand("<slnum>"))
- " Moved the filetype detect here from NetrwGetFile() because remote files
- " were having their filetype detect-generated settings overwritten by
- " NetrwOptionRestore.
- if &ft != "netrw"
-" call Decho("filetype detect (ft=".&ft.")",'~'.expand("<slnum>"))
- filetype detect
- endif
-" 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:NetrwOptionRestore : tab#".tabpagenr()." win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> modified=".&modified." modifiable=".&modifiable." readonly=".&readonly)
-endfun
-
-" ---------------------------------------------------------------------
-" s:NetrwOptionSave: save options prior to setting to "netrw-buffer-standard" form {{{2
-" Options get restored by s:NetrwOptionRestore()
-" 06/08/07 : removed call to NetrwSafeOptions(), either placed
-" immediately after NetrwOptionSave() calls in NetRead
-" and NetWrite, or after the s:NetrwEnew() call in
-" 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("%")).">"." winnr($)=".winnr("$")." mod=".&mod." ma=".&ma)
+" s:NetrwOptionsSave: save options prior to setting to "netrw-buffer-standard" form {{{2
+" Options get restored by s:NetrwOptionsRestore()
+"
+" Option handling:
+" * save user's options (s:NetrwOptionsSave)
+" * set netrw-safe options (s:NetrwOptionsSafe)
+" - change an option only when user option != safe option (s:netrwSetSafeSetting)
+" * restore user's options (s:netrwOPtionsRestore)
+" - restore a user option when != safe option (s:NetrwRestoreSetting)
+" vt: (variable type) normally its either "w:" or "s:"
+fun! s:NetrwOptionsSave(vt)
+" call Dfunc("s:NetrwOptionsSave(vt<".a:vt.">) win#".winnr()." buf#".bufnr("%")."<".bufname(bufnr("%")).">"." winnr($)=".winnr("$")." mod=".&mod." ma=".&ma)
" call Decho(a:vt."netrw_optionsave".(exists("{a:vt}netrw_optionsave")? ("=".{a:vt}netrw_optionsave) : " doesn't exist"),'~'.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." a:vt=".a:vt,'~'.expand("<slnum>"))
if !exists("{a:vt}netrw_optionsave")
let {a:vt}netrw_optionsave= 1
else
-" call Dret("s:NetrwOptionSave : options already saved")
+" call Dret("s:NetrwOptionsSave : options already saved")
return
endif
" call Decho("prior to save: fo=".&fo.(exists("+acd")? " acd=".&acd : " acd doesn't exist")." diff=".&l:diff,'~'.expand("<slnum>"))
@@ -1707,6 +1642,7 @@ fun! s:NetrwOptionSave(vt)
let {a:vt}netrw_cpokeep = &l:cpo
let {a:vt}netrw_diffkeep = &l:diff
let {a:vt}netrw_fenkeep = &l:fen
+" call Decho("saving current settings: got here#1",'~'.expand("<slnum>"))
if !exists("g:netrw_ffkeep") || g:netrw_ffkeep
let {a:vt}netrw_ffkeep = &l:ff
endif
@@ -1725,12 +1661,10 @@ fun! s:NetrwOptionSave(vt)
let {a:vt}netrw_rokeep = &l:ro
let {a:vt}netrw_selkeep = &l:sel
let {a:vt}netrw_spellkeep = &l:spell
+" call Decho("saving current settings: got here#2",'~'.expand("<slnum>"))
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
@@ -1743,48 +1677,53 @@ fun! s:NetrwOptionSave(vt)
let {a:vt}netrw_dirkeep = getcwd()
endif
if has("clipboard")
- if &go =~# 'a' | sil! let {a:vt}netrw_regstar = @* | endif
+ sil! let {a:vt}netrw_starkeep = @*
+ sil! let {a:vt}netrw_pluskeep = @+
endif
- sil! let {a:vt}netrw_regslash= @/
+ sil! let {a:vt}netrw_slashkeep= @/
" 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())
+" call Dret("s:NetrwOptionsSave : tab#".tabpagenr()." win#".winnr())
endfun
-" ------------------------------------------------------------------------
-" s:NetrwSafeOptions: sets options to help netrw do its job {{{2
+" ---------------------------------------------------------------------
+" s:NetrwOptionsSafe: sets options to help netrw do its job {{{2
" Use s:NetrwSaveOptions() to save user settings
-" Use s:NetrwOptionRestore() to restore user settings
-fun! s:NetrwSafeOptions()
-" call Dfunc("s:NetrwSafeOptions() win#".winnr()." buf#".bufnr("%")."<".bufname(bufnr("%"))."> winnr($)=".winnr("$"))
+" Use s:NetrwOptionsRestore() to restore user settings
+fun! s:NetrwOptionsSafe(islocal)
+" call Dfunc("s:NetrwOptionsSafe(islocal=".a:islocal.") 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") | 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
+ if exists("+acd") | call s:NetrwSetSafeSetting("&l:acd",0)|endif
+ call s:NetrwSetSafeSetting("&l:ai",0)
+ call s:NetrwSetSafeSetting("&l:aw",0)
+ call s:NetrwSetSafeSetting("&l:bl",0)
+ call s:NetrwSetSafeSetting("&l:bomb",0)
+ if a:islocal
+ call s:NetrwSetSafeSetting("&l:bt","nofile")
+ else
+ call s:NetrwSetSafeSetting("&l:bt","acwrite")
+ endif
+ call s:NetrwSetSafeSetting("&l:ci",0)
+ call s:NetrwSetSafeSetting("&l:cin",0)
+ call s:NetrwSetSafeSetting("&l:bh","hide")
+ call s:NetrwSetSafeSetting("&l:cino","")
+ call s:NetrwSetSafeSetting("&l:com","")
+ if &cpo =~ 'a' | call s:NetrwSetSafeSetting("&cpo",substitute(&cpo,'a','','g')) | endif
+ if &cpo =~ 'A' | call s:NetrwSetSafeSetting("&cpo",substitute(&cpo,'A','','g')) | endif
setl fo=nroql2
- setl nohid
- setl noim
+ call s:NetrwSetSafeSetting("&l:hid",0)
+ call s:NetrwSetSafeSetting("&l:im",0)
setl isk+=@ isk+=* isk+=/
- setl magic
+ call s:NetrwSetSafeSetting("&l:magic",1)
if g:netrw_use_noswf
- setl noswf
+ call s:NetrwSetSafeSetting("swf",0)
endif
- setl report=10000
- setl sel=inclusive
- setl nospell
- setl tw=0
- setl wig=
+ call s:NetrwSetSafeSetting("&l:report",10000)
+ call s:NetrwSetSafeSetting("&l:sel","inclusive")
+ call s:NetrwSetSafeSetting("&l:spell",0)
+ call s:NetrwSetSafeSetting("&l:tw",0)
+ call s:NetrwSetSafeSetting("&l:wig","")
setl cedit&
call s:NetrwCursor()
@@ -1792,12 +1731,194 @@ 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>"))
- sil! keepalt NetrwKeepj doau FileType netrw
+ 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>"))
" 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>"))
-" call Dret("s:NetrwSafeOptions")
+" call Dret("s:NetrwOptionsSafe")
+endfun
+
+" ---------------------------------------------------------------------
+" s:NetrwOptionsRestore: restore options (based on prior s:NetrwOptionsSave) {{{2
+fun! s:NetrwOptionsRestore(vt)
+" call Dfunc("s:NetrwOptionsRestore(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 Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl