mirror of
https://github.com/neovim/neovim.git
synced 2024-12-20 19:25:11 -07:00
Merge pull request #13949 from janlazo/runtime-netrw
runtime/netrw: port missing Vim 8.1,8.2 runtime patches
This commit is contained in:
commit
7250d521c5
@ -1,8 +1,8 @@
|
||||
" netrw.vim: Handles file transfer and remote directory listing across
|
||||
" AUTOLOAD SECTION
|
||||
" Date: Jul 16, 2019
|
||||
" Version: 165
|
||||
" Maintainer: Charles E Campbell <NdrOchip@ScampbellPfamily.AbizM-NOSPAM>
|
||||
" Date: Jan 07, 2020
|
||||
" Version: 168
|
||||
" Maintainer: Charles E Campbell <NcampObell@SdrPchip.AorgM-NOSPAM>
|
||||
" GetLatestVimScripts: 1075 1 :AutoInstall: netrw.vim
|
||||
" Copyright: Copyright (C) 2016 Charles E. Campbell {{{1
|
||||
" Permission is hereby granted to use and distribute this code,
|
||||
@ -13,6 +13,10 @@
|
||||
" expressed or implied. 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.
|
||||
"
|
||||
" Note: the code here was started in 1999 under a much earlier version of vim. The directory browsing
|
||||
" code was written using vim v6, which did not have Lists (Lists were first offered with vim-v7).
|
||||
"
|
||||
"redraw!|call DechoSep()|call inputsave()|call input("Press <cr> to continue")|call inputrestore()
|
||||
"
|
||||
" But be doers of the Word, and not only hearers, deluding your own selves {{{1
|
||||
@ -39,7 +43,7 @@ if exists("s:needspatches")
|
||||
endfor
|
||||
endif
|
||||
|
||||
let g:loaded_netrw = "v165"
|
||||
let g:loaded_netrw = "v168"
|
||||
if !exists("s:NOTE")
|
||||
let s:NOTE = 0
|
||||
let s:WARNING = 1
|
||||
@ -64,7 +68,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
|
||||
" Dec 2, 2019 : max errnum currently is 106
|
||||
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)
|
||||
|
||||
@ -232,12 +236,12 @@ if !exists("g:netrw_ftp_options")
|
||||
let g:netrw_ftp_options= "-i -n"
|
||||
endif
|
||||
if !exists("g:netrw_http_cmd")
|
||||
if executable("curl")
|
||||
let g:netrw_http_cmd = "curl"
|
||||
call s:NetrwInit("g:netrw_http_xcmd","-L -o")
|
||||
elseif executable("wget")
|
||||
if executable("wget")
|
||||
let g:netrw_http_cmd = "wget"
|
||||
call s:NetrwInit("g:netrw_http_xcmd","-q -O")
|
||||
elseif executable("curl")
|
||||
let g:netrw_http_cmd = "curl"
|
||||
call s:NetrwInit("g:netrw_http_xcmd","-L -o")
|
||||
elseif executable("elinks")
|
||||
let g:netrw_http_cmd = "elinks"
|
||||
call s:NetrwInit("g:netrw_http_xcmd","-source >")
|
||||
@ -443,23 +447,9 @@ 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 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)
|
||||
endif
|
||||
if has("win32") || has("win95") || has("win64") || has("win16")
|
||||
if g:netrw_cygwin
|
||||
call s:NetrwInit("g:netrw_localrmdir","rmdir")
|
||||
else
|
||||
let g:netrw_localrmdir = expand("$COMSPEC")
|
||||
let g:netrw_localrmdiropt= " /c rmdir"
|
||||
endif
|
||||
else
|
||||
call s:NetrwInit("g:netrw_localrmdir","rmdir")
|
||||
endif
|
||||
endif
|
||||
" following serves as an example for how to insert a version&patch specific test
|
||||
"if v:version < 704 || (v:version == 704 && !has("patch1107"))
|
||||
"endif
|
||||
call s:NetrwInit("g:netrw_liststyle" , s:THINLIST)
|
||||
" sanity checks
|
||||
if g:netrw_liststyle < 0 || g:netrw_liststyle >= s:MAXLIST
|
||||
@ -1500,7 +1490,8 @@ fun! netrw#Obtain(islocal,fname,...)
|
||||
" -i : turns off interactive prompting from ftp
|
||||
" -n unix : DON'T use <.netrc>, even though it exists
|
||||
" -n win32: quit being obnoxious about password
|
||||
NetrwKeepj norm! 1Gdd
|
||||
" Note: using "_dd to delete to the black hole register; avoids messing up @@
|
||||
NetrwKeepj norm! 1G"_dd
|
||||
call s:NetrwExe(s:netrw_silentxfer."%!".s:netrw_ftp_cmd." ".g:netrw_ftp_options)
|
||||
" If the result of the ftp operation isn't blank, show an error message (tnx to Doug Claar)
|
||||
if getline(1) !~ "^$"
|
||||
@ -1614,7 +1605,6 @@ fun! s:NetrwOptionsSave(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
|
||||
@ -1633,7 +1623,6 @@ fun! s:NetrwOptionsSave(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
|
||||
@ -1647,6 +1636,7 @@ fun! s:NetrwOptionsSave(vt)
|
||||
" call Decho("saving a few selected netrw-related variables",'~'.expand("<slnum>"))
|
||||
if g:netrw_keepdir
|
||||
let {a:vt}netrw_dirkeep = getcwd()
|
||||
" call Decho("saving to ".a:vt."netrw_dirkeep<".{a:vt}netrw_dirkeep.">",'~'.expand("<slnum>"))
|
||||
endif
|
||||
sil! let {a:vt}netrw_slashkeep= @/
|
||||
|
||||
@ -1713,6 +1703,7 @@ 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("case ".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>"))
|
||||
" 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:NetrwOptionsRestore : ".a:vt."netrw_optionsave doesn't exist")
|
||||
@ -1854,7 +1845,7 @@ endfun
|
||||
" Used by s:NetrwOptionsRestore() to restore each netrw-senstive setting
|
||||
" keepvars are set up by s:NetrwOptionsSave
|
||||
fun! s:NetrwRestoreSetting(keepvar,setting)
|
||||
"" call Dfunc("s:NetrwRestoreSetting(a:keepvar<".a:keepvar."> a:setting<".a:setting.">)")
|
||||
""" call Dfunc("s:NetrwRestoreSetting(a:keepvar<".a:keepvar."> a:setting<".a:setting.">)")
|
||||
|
||||
" typically called from s:NetrwOptionsRestore
|
||||
" call s:NetrwRestoreSettings(keep-option-variable-name,'associated-option')
|
||||
@ -1869,7 +1860,7 @@ fun! s:NetrwRestoreSetting(keepvar,setting)
|
||||
"" call Decho("fyi: a:setting<".a:setting."> setting<".setting.">")
|
||||
|
||||
if setting != keepvarval
|
||||
"" call Decho("restore setting<".a:setting."=".setting."> to keepvarval<".keepvarval.">")
|
||||
"" call Decho("restore setting<".a:setting."> (currently=".setting.") to keepvarval<".keepvarval.">")
|
||||
if type(a:setting) == 0
|
||||
exe "let ".a:setting."= ".keepvarval
|
||||
elseif type(a:setting) == 1
|
||||
@ -2159,7 +2150,7 @@ fun! netrw#NetRead(mode,...)
|
||||
" -i : turns off interactive prompting from ftp
|
||||
" -n unix : DON'T use <.netrc>, even though it exists
|
||||
" -n win32: quit being obnoxious about password
|
||||
NetrwKeepj norm! 1Gdd
|
||||
NetrwKeepj norm! 1G"_dd
|
||||
call s:NetrwExe(s:netrw_silentxfer."%!".s:netrw_ftp_cmd." ".g:netrw_ftp_options)
|
||||
" If the result of the ftp operation isn't blank, show an error message (tnx to Doug Claar)
|
||||
if getline(1) !~ "^$"
|
||||
@ -2259,7 +2250,7 @@ fun! netrw#NetRead(mode,...)
|
||||
NetrwKeepj put ='quit'
|
||||
|
||||
" perform cadaver operation:
|
||||
NetrwKeepj norm! 1Gdd
|
||||
NetrwKeepj norm! 1G"_dd
|
||||
call s:NetrwExe(s:netrw_silentxfer."%!".g:netrw_dav_cmd)
|
||||
keepj bd!
|
||||
endif
|
||||
@ -2575,7 +2566,7 @@ fun! netrw#NetWrite(...) range
|
||||
" -i : turns off interactive prompting from ftp
|
||||
" -n unix : DON'T use <.netrc>, even though it exists
|
||||
" -n win32: quit being obnoxious about password
|
||||
NetrwKeepj norm! 1Gdd
|
||||
NetrwKeepj norm! 1G"_dd
|
||||
call s:NetrwExe(s:netrw_silentxfer."%!".s:netrw_ftp_cmd." ".g:netrw_ftp_options)
|
||||
" If the result of the ftp operation isn't blank, show an error message (tnx to Doug Claar)
|
||||
if getline(1) !~ "^$"
|
||||
@ -2641,7 +2632,7 @@ fun! netrw#NetWrite(...) range
|
||||
NetrwKeepj put ='put '.tmpfile.' '.netrw_fname
|
||||
|
||||
" perform cadaver operation:
|
||||
NetrwKeepj norm! 1Gdd
|
||||
NetrwKeepj norm! 1G"_dd
|
||||
call s:NetrwExe(s:netrw_silentxfer."%!".g:netrw_dav_cmd)
|
||||
|
||||
" remove enew buffer (quietly)
|
||||
@ -2827,7 +2818,7 @@ fun! s:NetrwGetFile(readcmd, tfile, method)
|
||||
" readcmd=='t': simply do nothing
|
||||
if a:readcmd == 't'
|
||||
" call Decho(" ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)",'~'.expand("<slnum>"))
|
||||
" call Dret("NetrwGetFile : skip read of <".a:tfile.">")
|
||||
" call Dret("NetrwGetFile : skip read of tfile<".a:tfile.">")
|
||||
return
|
||||
endif
|
||||
|
||||
@ -4323,7 +4314,7 @@ fun! s:NetrwGetWord()
|
||||
let curline= getline('.')
|
||||
|
||||
if curline =~# '"\s*Sorted by\s'
|
||||
NetrwKeepj norm! s
|
||||
NetrwKeepj norm! "_s
|
||||
let s:netrw_skipbrowse= 1
|
||||
echo 'Pressing "s" also works'
|
||||
|
||||
@ -5158,17 +5149,31 @@ fun! s:NetrwBrowseUpDir(islocal)
|
||||
endfun
|
||||
|
||||
" ---------------------------------------------------------------------
|
||||
" netrw#BrowseX: (implements "x") executes a special "viewer" script or program for the {{{2
|
||||
" netrw#BrowseX: (implements "x" and "gx") executes a special "viewer" script or program for the {{{2
|
||||
" given filename; typically this means given their extension.
|
||||
" 0=local, 1=remote
|
||||
fun! netrw#BrowseX(fname,remote)
|
||||
" call Dfunc("netrw#BrowseX(fname<".a:fname."> remote=".a:remote.")")
|
||||
let use_ctrlo= 1
|
||||
" call Dfunc("netrw#BrowseX(fname<".a:fname."> remote=".a:remote.") implements x and gx maps")
|
||||
|
||||
" if its really just a local directory, then do a "gf" instead
|
||||
if (a:remote == 0 && isdirectory(a:fname)) || (a:remote == 1 && a:fname =~ '/$' && a:fname !~ '^https\=:')
|
||||
if a:remote == 0 && isdirectory(a:fname)
|
||||
" if its really just a local directory, then do a "gf" instead
|
||||
" call Decho("remote≡0 and a:fname<".a:fname."> ".(isdirectory(a:fname)? "is a directory" : "is not a directory"),'~'.expand("<slnum>"))
|
||||
" call Decho("..appears to be a local directory; using e ".a:fname." instead",'~'.expand("<slnum>"))
|
||||
exe "e ".a:fname
|
||||
" call Dret("netrw#BrowseX")
|
||||
return
|
||||
elseif a:remote == 1 && a:fname !~ '^https\=:' && a:fname =~ '/$'
|
||||
" remote directory, not a webpage access, looks like an attempt to do a directory listing
|
||||
" call Decho("remote≡1 and a:fname<".a:fname.">",'~'.expand("<slnum>"))
|
||||
" call Decho("..and fname ".((a:fname =~ '^https\=:')? 'matches' : 'does not match').'^https\=:','~'.expand("<slnum>"))
|
||||
" call Decho("..and fname ".((a:fname =~ '/$')? 'matches' : 'does not match').' /$','~'.expand("<slnum>"))
|
||||
" call Decho("..appears to be a remote directory listing request; using gf instead",'~'.expand("<slnum>"))
|
||||
norm! gf
|
||||
" call Dret("(netrw#BrowseX) did gf instead")
|
||||
" call Dret("netrw#BrowseX")
|
||||
return
|
||||
endif
|
||||
" call Decho("not a local file nor a webpage request",'~'.expand("<slnum>"))
|
||||
|
||||
let ykeep = @@
|
||||
let screenposn = winsaveview()
|
||||
@ -5266,10 +5271,9 @@ fun! netrw#BrowseX(fname,remote)
|
||||
endif
|
||||
" call Decho("set up redirection: redir{".redir."} srr{".&srr."}",'~'.expand("<slnum>"))
|
||||
|
||||
" extract any viewing options. Assumes that they're set apart by quotes.
|
||||
" call Decho("extract any viewing options",'~'.expand("<slnum>"))
|
||||
" extract any viewing options. Assumes that they're set apart by spaces.
|
||||
if exists("g:netrw_browsex_viewer")
|
||||
" call Decho("g:netrw_browsex_viewer<".g:netrw_browsex_viewer.">",'~'.expand("<slnum>"))
|
||||
" call Decho("extract any viewing options from g:netrw_browsex_viewer<".g:netrw_browsex_viewer.">",'~'.expand("<slnum>"))
|
||||
if g:netrw_browsex_viewer =~ '\s'
|
||||
let viewer = substitute(g:netrw_browsex_viewer,'\s.*$','','')
|
||||
let viewopt = substitute(g:netrw_browsex_viewer,'^\S\+\s*','','')." "
|
||||
@ -5292,16 +5296,16 @@ fun! netrw#BrowseX(fname,remote)
|
||||
" execute the file handler
|
||||
" call Decho("execute the file handler (if any)",'~'.expand("<slnum>"))
|
||||
if exists("g:netrw_browsex_viewer") && g:netrw_browsex_viewer == '-'
|
||||
" call Decho("g:netrw_browsex_viewer<".g:netrw_browsex_viewer.">",'~'.expand("<slnum>"))
|
||||
" call Decho("(netrw#BrowseX) g:netrw_browsex_viewer<".g:netrw_browsex_viewer.">",'~'.expand("<slnum>"))
|
||||
let ret= netrwFileHandlers#Invoke(exten,fname)
|
||||
|
||||
elseif exists("g:netrw_browsex_viewer") && executable(viewer)
|
||||
" call Decho("g:netrw_browsex_viewer<".g:netrw_browsex_viewer.">",'~'.expand("<slnum>"))
|
||||
" call Decho("(netrw#BrowseX) g:netrw_browsex_viewer<".g:netrw_browsex_viewer.">",'~'.expand("<slnum>"))
|
||||
call s:NetrwExe("sil !".viewer." ".viewopt.s:ShellEscape(fname,1).redir)
|
||||
let ret= v:shell_error
|
||||
|
||||
elseif has("win32") || has("win64")
|
||||
" call Decho("win".(has("win32")? "32" : "64")",'~'.expand("<slnum>"))
|
||||
" call Decho("(netrw#BrowseX) win".(has("win32")? "32" : "64"),'~'.expand("<slnum>"))
|
||||
if executable("start")
|
||||
call s:NetrwExe('sil! !start rundll32 url.dll,FileProtocolHandler '.s:ShellEscape(fname,1))
|
||||
elseif executable("rundll32")
|
||||
@ -5309,56 +5313,68 @@ fun! netrw#BrowseX(fname,remote)
|
||||
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
|
||||
|
||||
elseif has("win32unix")
|
||||
let winfname= 'c:\cygwin'.substitute(fname,'/','\\','g')
|
||||
" call Decho("cygwin: winfname<".s:ShellEscape(winfname,1).">",'~'.expand("<slnum>"))
|
||||
" call Decho("(netrw#BrowseX) cygwin: winfname<".s:ShellEscape(winfname,1).">",'~'.expand("<slnum>"))
|
||||
if executable("start")
|
||||
" call Decho("(netrw#BrowseX) win32unix+start",'~'.expand("<slnum>"))
|
||||
call s:NetrwExe('sil !start rundll32 url.dll,FileProtocolHandler '.s:ShellEscape(winfname,1))
|
||||
elseif executable("rundll32")
|
||||
" call Decho("(netrw#BrowseX) win32unix+rundll32",'~'.expand("<slnum>"))
|
||||
call s:NetrwExe('sil !rundll32 url.dll,FileProtocolHandler '.s:ShellEscape(winfname,1))
|
||||
elseif executable("cygstart")
|
||||
" call Decho("(netrw#BrowseX) win32unix+cygstart",'~'.expand("<slnum>"))
|
||||
call s:NetrwExe('sil !cygstart '.s: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
|
||||
|
||||
elseif has("unix") && executable("kfmclient") && s:CheckIfKde()
|
||||
" call Decho("unix and kfmclient",'~'.expand("<slnum>"))
|
||||
" call Decho("(netrw#BrowseX) unix and kfmclient",'~'.expand("<slnum>"))
|
||||
call s:NetrwExe("sil !kfmclient exec ".s:ShellEscape(fname,1)." ".redir)
|
||||
let ret= v:shell_error
|
||||
|
||||
elseif has("unix") && executable("exo-open") && executable("xdg-open") && executable("setsid")
|
||||
" call Decho("unix, exo-open, xdg-open",'~'.expand("<slnum>"))
|
||||
" call Decho("(netrw#BrowseX) unix, exo-open, xdg-open",'~'.expand("<slnum>"))
|
||||
call s:NetrwExe("sil !setsid xdg-open ".s:ShellEscape(fname,1).redir)
|
||||
let ret= v:shell_error
|
||||
|
||||
elseif has("unix") && $DESKTOP_SESSION == "mate" && executable("atril")
|
||||
" call Decho("unix and atril",'~'.expand("<slnum>"))
|
||||
call s:NetrwExe("sil !atril ".s:ShellEscape(fname,1).redir)
|
||||
" call Decho("(netrw#BrowseX) unix and atril",'~'.expand("<slnum>"))
|
||||
if a:fname =~ '^https\=://'
|
||||
" atril does not appear to understand how to handle html -- so use gvim to edit the document
|
||||
let use_ctrlo= 0
|
||||
" call Decho("(COMBAK) fname<".fname.">")
|
||||
" call Decho("(COMBAK) a:fname<".a:fname.">")
|
||||
call s:NetrwExe("sil! !gvim ".fname.' -c "keepj keepalt file '.fnameescape(a:fname).'"')
|
||||
|
||||
else
|
||||
call s:NetrwExe("sil !atril ".s:ShellEscape(fname,1).redir)
|
||||
endif
|
||||
let ret= v:shell_error
|
||||
|
||||
elseif has("unix") && executable("xdg-open")
|
||||
" call Decho("unix and xdg-open",'~'.expand("<slnum>"))
|
||||
" call Decho("(netrw#BrowseX) unix and xdg-open",'~'.expand("<slnum>"))
|
||||
call s:NetrwExe("sil !xdg-open ".s:ShellEscape(fname,1).redir)
|
||||
let ret= v:shell_error
|
||||
|
||||
elseif has("macunix") && executable("open")
|
||||
" call Decho("macunix and open",'~'.expand("<slnum>"))
|
||||
" call Decho("(netrw#BrowseX) macunix and open",'~'.expand("<slnum>"))
|
||||
call s:NetrwExe("sil !open ".s:ShellEscape(fname,1)." ".redir)
|
||||
let ret= v:shell_error
|
||||
|
||||
else
|
||||
" netrwFileHandlers#Invoke() always returns 0
|
||||
" call Decho("(netrw#BrowseX) use netrwFileHandlers",'~'.expand("<slnum>"))
|
||||
let ret= netrwFileHandlers#Invoke(exten,fname)
|
||||
endif
|
||||
|
||||
" if unsuccessful, attempt netrwFileHandlers#Invoke()
|
||||
if ret
|
||||
" call Decho("(netrw#BrowseX) ret=".ret," indicates unsuccessful thus far",'~'.expand("<slnum>"))
|
||||
let ret= netrwFileHandlers#Invoke(exten,fname)
|
||||
endif
|
||||
|
||||
@ -5380,8 +5396,9 @@ fun! netrw#BrowseX(fname,remote)
|
||||
if g:netrw_use_noswf
|
||||
setl noswf
|
||||
endif
|
||||
exe "sil! NetrwKeepj norm! \<c-o>"
|
||||
" redraw!
|
||||
if use_ctrlo
|
||||
exe "sil! NetrwKeepj norm! \<c-o>"
|
||||
endif
|
||||
endif
|
||||
" call Decho("restoring posn to screenposn<".string(screenposn).">",'~'.expand("<slnum>"))
|
||||
call winrestview(screenposn)
|
||||
@ -5410,11 +5427,11 @@ endfun
|
||||
" netrw#BrowseXVis: used by gx in visual mode to select a file for browsing {{{2
|
||||
fun! netrw#BrowseXVis()
|
||||
" call Dfunc("netrw#BrowseXVis()")
|
||||
let atkeep = @@
|
||||
norm! gvy
|
||||
" call Decho("@@<".@@.">",'~'.expand("<slnum>"))
|
||||
call netrw#BrowseX(@@,netrw#CheckIfRemote(@@))
|
||||
let @@ = atkeep
|
||||
let akeep = @a
|
||||
norm! gv"ay
|
||||
let gxfile= @a
|
||||
let @a = akeep
|
||||
call netrw#BrowseX(gxfile,netrw#CheckIfRemote(gxfile))
|
||||
" call Dret("netrw#BrowseXVis")
|
||||
endfun
|
||||
|
||||
@ -6039,13 +6056,12 @@ fun! s:NetrwSLeftrelease(islocal)
|
||||
endfun
|
||||
|
||||
" ---------------------------------------------------------------------
|
||||
" s:NetrwListHide: uses [range]g~...~d to delete files that match comma {{{2
|
||||
" separated patterns given in g:netrw_list_hide
|
||||
" s:NetrwListHide: uses [range]g~...~d to delete files that match {{{2
|
||||
" comma-separated patterns given in g:netrw_list_hide
|
||||
fun! s:NetrwListHide()
|
||||
" call Dfunc("s:NetrwListHide() g:netrw_hide=".g:netrw_hide." g:netrw_list_hide<".g:netrw_list_hide.">")
|
||||
" call Decho("initial: ".string(getline(w:netrw_bannercnt,'$')))
|
||||
let ykeep= @@
|
||||
" call DechoBuf(bufnr("%"),"COMBAK#3")
|
||||
|
||||
" find a character not in the "hide" string to use as a separator for :g and :v commands
|
||||
" How-it-works: take the hiding command, convert it into a range.
|
||||
@ -6054,8 +6070,8 @@ fun! s:NetrwListHide()
|
||||
" Use the first character left as a separator character.
|
||||
" call Decho("find a character not in the hide string to use as a separator")
|
||||
let listhide= g:netrw_list_hide
|
||||
let sep = strpart(substitute('/~@#$%^&*{};:,<.>?|1234567890','['.escape(listhide,'-]^\').']','','ge'),1,1)
|
||||
" call Decho("sep=".sep,'~'.expand("<slnum>"))
|
||||
let sep = strpart(substitute('~@#$%^&*{};:,<.>?|1234567890','['.escape(listhide,'-]^\').']','','ge'),1,1)
|
||||
" call Decho("sep=".sep," (sep not in hide string)'~'.expand("<slnum>"))
|
||||
|
||||
while listhide != ""
|
||||
if listhide =~ ','
|
||||
@ -6065,10 +6081,19 @@ fun! s:NetrwListHide()
|
||||
let hide = listhide
|
||||
let listhide = ""
|
||||
endif
|
||||
" call Decho("hide<".hide."> listhide<".listhide.'>','~'.expand("<slnum>"))
|
||||
" call Decho("..extracted from listhide: hide<".hide."> g:netrw_sort_by<".g:netrw_sort_by.'>','~'.expand("<slnum>"))
|
||||
if g:netrw_sort_by =~ '^[ts]'
|
||||
if hide =~ '^\^'
|
||||
" call Decho("..modify hide to handle a \"^...\" pattern",'~'.expand("<slnum>"))
|
||||
let hide= substitute(hide,'^\^','^\(\\d\\+/\)','')
|
||||
elseif hide =~ '^\\(\^'
|
||||
let hide= substitute(hide,'^\\(\^','\\(^\\(\\d\\+/\\)','')
|
||||
endif
|
||||
" call Decho("..hide<".hide."> listhide<".listhide.'>','~'.expand("<slnum>"))
|
||||
endif
|
||||
|
||||
" Prune the list by hiding any files which match
|
||||
" call Decho("prune the list by hiding any files which ",((g:netrw_hide == 1)? "" : "don't")." match hide<".hide.">")
|
||||
" call Decho("..prune the list by hiding any files which ",((g:netrw_hide == 1)? "" : "don't")." match hide<".hide.">")
|
||||
if g:netrw_hide == 1
|
||||
" call Decho("..hiding<".hide.">",'~'.expand("<slnum>"))
|
||||
exe 'sil! NetrwKeepj '.w:netrw_bannercnt.',$g'.sep.hide.sep.'d'
|
||||
@ -6089,7 +6114,6 @@ fun! s:NetrwListHide()
|
||||
" remove any blank lines that have somehow remained.
|
||||
" This seems to happen under Windows.
|
||||
exe 'sil! NetrwKeepj 1,$g@^\s*$@d'
|
||||
" call DechoBuf(bufnr("%"),"COMBAK#4")
|
||||
|
||||
let @@= ykeep
|
||||
" call Dret("s:NetrwListHide")
|
||||
@ -6297,7 +6321,7 @@ fun! s:NetrwMaps(islocal)
|
||||
|
||||
" generate default <Plug> maps {{{3
|
||||
if !hasmapto('<Plug>NetrwHide') |nmap <buffer> <silent> <nowait> a <Plug>NetrwHide_a|endif
|
||||
if !hasmapto('<Plug>NetrwBrowseUpDir') |nmap <buffer> <silent> <nowait> - <Plug>NetrwBrowseUpDir |endif
|
||||
if !hasmapto('<Plug>NetrwBrowseUpDir') |nmap <buffer> <silent> <nowait> - <Plug>NetrwBrowseUpDir|endif
|
||||
if !hasmapto('<Plug>NetrwOpenFile') |nmap <buffer> <silent> <nowait> % <Plug>NetrwOpenFile|endif
|
||||
if !hasmapto('<Plug>NetrwBadd_cb') |nmap <buffer> <silent> <nowait> cb <Plug>NetrwBadd_cb|endif
|
||||
if !hasmapto('<Plug>NetrwBadd_cB') |nmap <buffer> <silent> <nowait> cB <Plug>NetrwBadd_cB|endif
|
||||
@ -6614,9 +6638,9 @@ fun! s:NetrwMarkFiles(islocal,...)
|
||||
while i <= a:0
|
||||
if a:islocal
|
||||
if v:version > 704 || (v:version == 704 && has("patch656"))
|
||||
let mffiles= glob(fnameescape(a:{i}),0,1,1)
|
||||
let mffiles= glob(a:{i},0,1,1)
|
||||
else
|
||||
let mffiles= glob(fnameescape(a:{i}),0,1)
|
||||
let mffiles= glob(a:{i},0,1)
|
||||
endif
|
||||
else
|
||||
let mffiles= [a:{i}]
|
||||
@ -6757,13 +6781,15 @@ fun! s:NetrwMarkFile(islocal,fname)
|
||||
if index(s:netrwmarkfilelist,dname) == -1
|
||||
" append new filename to global markfilelist
|
||||
call add(s:netrwmarkfilelist,s:ComposePath(b:netrw_curdir,a:fname))
|
||||
" call Decho("append filename<".a:fname."> to global markfilelist<".string(s:netrwmarkfilelist).">",'~'.expand("<slnum>"))
|
||||
" call Decho("append filename<".a:fname."> to global s:markfilelist<".string(s:netrwmarkfilelist).">",'~'.expand("<slnum>"))
|
||||
else
|
||||
" remove new filename from global markfilelist
|
||||
" call Decho("filter(".string(s:netrwmarkfilelist).",'v:val != '.".dname.")",'~'.expand("<slnum>"))
|
||||
" call Decho("remove new filename from global s:markfilelist",'~'.expand("<slnum>"))
|
||||
" call Decho("..filter(".string(s:netrwmarkfilelist).",'v:val != '.".dname.")",'~'.expand("<slnum>"))
|
||||
call filter(s:netrwmarkfilelist,'v:val != "'.dname.'"')
|
||||
" call Decho("ending s:netrwmarkfilelist <".string(s:netrwmarkfilelist).">",'~'.expand("<slnum>"))
|
||||
" call Decho("..ending s:netrwmarkfilelist <".string(s:netrwmarkfilelist).">",'~'.expand("<slnum>"))
|
||||
if s:netrwmarkfilelist == []
|
||||
" call Decho("s:netrwmarkfilelist is empty; unlet it",'~'.expand("<slnum>"))
|
||||
unlet s:netrwmarkfilelist
|
||||
endif
|
||||
endif
|
||||
@ -6787,7 +6813,8 @@ fun! s:NetrwMarkFile(islocal,fname)
|
||||
endif
|
||||
endif
|
||||
let @@= ykeep
|
||||
" call Dret("s:NetrwMarkFile : s:netrwmarkfilelist_".curbufnr."<".(exists("s:netrwmarkfilelist_{curbufnr}")? string(s:netrwmarkfilelist_{curbufnr}) : " doesn't exist").">")
|
||||
" call Decho("s:netrwmarkfilelist[".(exists("s:netrwmarkfilelist")? string(s:netrwmarkfilelist) : "")."] (avail in all buffers)",'~'.expand("<slnum>"))
|
||||
" call Dret("s:NetrwMarkFile : s:netrwmarkfilelist_".curbufnr."<".(exists("s:netrwmarkfilelist_{curbufnr}")? string(s:netrwmarkfilelist_{curbufnr}) : " doesn't exist")."> (buf#".curbufnr."list)")
|
||||
endfun
|
||||
|
||||
" ---------------------------------------------------------------------
|
||||
@ -7078,17 +7105,8 @@ fun! s:NetrwMarkFileCopy(islocal,...)
|
||||
" call Dret("s:NetrwMarkFileCopy : lcd failure")
|
||||
return
|
||||
endif
|
||||
if v:version < 704 || (v:version == 704 && !has("patch1107"))
|
||||
call s:NetrwExe("sil !".g:netrw_localrmdir.g:netrw_localrmdiropt." ".s:ShellEscape(tmpdir,1))
|
||||
if v:shell_error != 0
|
||||
call netrw#ErrorMsg(s:WARNING,"consider setting g:netrw_localrmdir<".g:netrw_localrmdir."> to something that works",80)
|
||||
" " call Dret("s:NetrwMarkFileCopy : failed: sil !".g:netrw_localrmdir." ".s:ShellEscape(tmpdir,1) )
|
||||
return
|
||||
endif
|
||||
else
|
||||
if delete(tmpdir,"d")
|
||||
call netrw#ErrorMsg(s:ERROR,"unable to delete directory <".tmpdir.">!",103)
|
||||
endif
|
||||
if delete(tmpdir,"d")
|
||||
call netrw#ErrorMsg(s:ERROR,"unable to delete directory <".tmpdir.">!",103)
|
||||
endif
|
||||
else
|
||||
if s:NetrwLcd(curdir)
|
||||
@ -7542,8 +7560,9 @@ fun! s:NetrwMarkFileGrep(islocal)
|
||||
let curdir = s:NetrwGetCurdir(a:islocal)
|
||||
|
||||
if exists("s:netrwmarkfilelist")
|
||||
" call Decho("s:netrwmarkfilelist".string(s:netrwmarkfilelist).">",'~'.expand("<slnum>"))
|
||||
" call Decho("using s:netrwmarkfilelist".string(s:netrwmarkfilelist).">",'~'.expand("<slnum>"))
|
||||
let netrwmarkfilelist= join(map(deepcopy(s:netrwmarkfilelist), "fnameescape(v:val)"))
|
||||
" call Decho("keeping copy of s:netrwmarkfilelist in function-local variable,'~'.expand("<slnum>"))"
|
||||
call s:NetrwUnmarkAll()
|
||||
else
|
||||
" call Decho('no marked files, using "*"','~'.expand("<slnum>"))
|
||||
@ -7551,6 +7570,7 @@ fun! s:NetrwMarkFileGrep(islocal)
|
||||
endif
|
||||
|
||||
" ask user for pattern
|
||||
" call Decho("ask user for search pattern",'~'.expand("<slnum>"))
|
||||
call inputsave()
|
||||
let pat= input("Enter pattern: ","")
|
||||
call inputrestore()
|
||||
@ -8663,7 +8683,7 @@ fun! s:NetrwUpload(fname,tgt,...)
|
||||
" -i : turns off interactive prompting from ftp
|
||||
" -n unix : DON'T use <.netrc>, even though it exists
|
||||
" -n win32: quit being obnoxious about password
|
||||
NetrwKeepj norm! 1Gdd
|
||||
NetrwKeepj norm! 1G"_dd
|
||||
call s:NetrwExe(s:netrw_silentxfer."%!".s:netrw_ftp_cmd." ".g:netrw_ftp_options)
|
||||
" If the result of the ftp operation isn't blank, show an error message (tnx to Doug Claar)
|
||||
sil NetrwKeepj g/Local directory now/d
|
||||
@ -9501,15 +9521,19 @@ fun! s:NetrwWideListing()
|
||||
" fpl: filenames per line
|
||||
" fpc: filenames per column
|
||||
setl ma noro
|
||||
let keepa= @a
|
||||
" call Decho("setl ma noro",'~'.expand("<slnum>"))
|
||||
let b:netrw_cpf= 0
|
||||
if line("$") >= w:netrw_bannercnt
|
||||
" determine the maximum filename size; use that to set cpf
|
||||
exe 'sil NetrwKeepj '.w:netrw_bannercnt.',$g/^./if virtcol("$") > b:netrw_cpf|let b:netrw_cpf= virtcol("$")|endif'
|
||||
NetrwKeepj call histdel("/",-1)
|
||||
else
|
||||
let @a= keepa
|
||||
" call Dret("NetrwWideListing")
|
||||
return
|
||||
endif
|
||||
" allow for two spaces to separate columns
|
||||
let b:netrw_cpf= b:netrw_cpf + 2
|
||||
" call Decho("b:netrw_cpf=max_filename_length+2=".b:netrw_cpf,'~'.expand("<slnum>"))
|
||||
|
||||
@ -9532,10 +9556,11 @@ fun! s:NetrwWideListing()
|
||||
if newcolend > line("$") | let newcolend= line("$") | endif
|
||||
let newcolqty= newcolend - newcolstart
|
||||
exe newcolstart
|
||||
" COMBAK: both of the visual-mode using lines below are problematic vis-a-vis @*
|
||||
if newcolqty == 0
|
||||
exe "sil! NetrwKeepj norm! 0\<c-v>$hx".w:netrw_bannercnt."G$p"
|
||||
exe "sil! NetrwKeepj norm! 0\<c-v>$h\"ax".w:netrw_bannercnt."G$\"ap"
|
||||
else
|
||||
exe "sil! NetrwKeepj norm! 0\<c-v>".newcolqty.'j$hx'.w:netrw_bannercnt.'G$p'
|
||||
exe "sil! NetrwKeepj norm! 0\<c-v>".newcolqty.'j$h"ax'.w:netrw_bannercnt.'G$"ap'
|
||||
endif
|
||||
exe "sil! NetrwKeepj ".newcolstart.','.newcolend.'d _'
|
||||
exe 'sil! NetrwKeepj '.w:netrw_bannercnt
|
||||
@ -9546,6 +9571,7 @@ fun! s:NetrwWideListing()
|
||||
exe 'nno <buffer> <silent> b :call search(''^.\\|\s\s\zs\S'',''bW'')'."\<cr>"
|
||||
" call Decho("NetrwWideListing) setl noma nomod ro",'~'.expand("<slnum>"))
|
||||
exe "setl ".g:netrw_bufsettings
|
||||
let @a= keepa
|
||||
" call Decho("ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)",'~'.expand("<slnum>"))
|
||||
" call Dret("NetrwWideListing")
|
||||
return
|
||||
@ -9743,6 +9769,7 @@ fun! s:PerformListing(islocal)
|
||||
exe 'sil NetrwKeepj '.w:netrw_bannercnt.',$sort!'.' '.g:netrw_sort_options
|
||||
endif
|
||||
endif
|
||||
|
||||
" remove priority pattern prefix
|
||||
" call Decho("remove priority pattern prefix",'~'.expand("<slnum>"))
|
||||
exe 'sil! NetrwKeepj '.w:netrw_bannercnt.',$s/^\d\{3}'.g:netrw_sepchr.'//e'
|
||||
@ -9781,6 +9808,7 @@ fun! s:PerformListing(islocal)
|
||||
" call Decho('exe sil NetrwKeepj '.w:netrw_bannercnt.',$sort!','~'.expand("<slnum>"))
|
||||
exe 'sil! NetrwKeepj '.w:netrw_bannercnt.',$sort!'.' '.g:netrw_sort_options
|
||||
endif
|
||||
" call Decho("remove leading digits/ (sorting) information from listing",'~'.expand("<slnum>"))
|
||||
exe 'sil! NetrwKeepj '.w:netrw_bannercnt.',$s/^\d\{-}\///e'
|
||||
NetrwKeepj call histdel("/",-1)
|
||||
endif
|
||||
@ -9843,6 +9871,7 @@ fun! s:PerformListing(islocal)
|
||||
" call Decho("exe setl ts=".(g:netrw_maxfilenamelen+1),'~'.expand("<slnum>"))
|
||||
exe "setl ts=".(g:netrw_maxfilenamelen+1)
|
||||
endif
|
||||
" call Decho("PerformListing buffer:",'~'.expand("<slnum>"))
|
||||
" call DechoBuf(bufnr("%"))
|
||||
|
||||
if exists("s:treecurpos")
|
||||
@ -10810,7 +10839,6 @@ fun! s:LocalListing()
|
||||
for filename in filelist
|
||||
" call Decho(" ",'~'.expand("<slnum>"))
|
||||
" call Decho("for filename in filelist: filename<".filename.">",'~'.expand("<slnum>"))
|
||||
" call DechoBuf(bufnr("%"),"COMBAK#1")
|
||||
|
||||
if getftype(filename) == "link"
|
||||
" indicate a symbolic link
|
||||
@ -10868,10 +10896,10 @@ fun! s:LocalListing()
|
||||
|
||||
if w:netrw_liststyle == s:LONGLIST
|
||||
let sz = getfsize(filename)
|
||||
let fsz = strpart(" ",1,15-strlen(sz)).sz
|
||||
if g:netrw_sizestyle =~# "[hH]"
|
||||
let sz= s:NetrwHumanReadable(sz)
|
||||
endif
|
||||
let fsz = strpart(" ",1,15-strlen(sz)).sz
|
||||
let longfile= printf("%-".(g:netrw_maxfilenamelen+1)."s",pfile)
|
||||
let pfile = longfile.fsz." ".strftime(g:netrw_timefmt,getftime(filename))
|
||||
" call Decho("longlist support: sz=".sz." fsz=".fsz,'~'.expand("<slnum>"))
|
||||
@ -10879,10 +10907,11 @@ fun! s:LocalListing()
|
||||
|
||||
if g:netrw_sort_by =~# "^t"
|
||||
" sort by time (handles time up to 1 quintillion seconds, US)
|
||||
" Decorate listing by prepending a timestamp/ . Sorting will then be done based on time.
|
||||
" call Decho("getftime(".filename.")=".getftime(filename),'~'.expand("<slnum>"))
|
||||
let t = getftime(filename)
|
||||
let ft = strpart("000000000000000000",1,18-strlen(t)).t
|
||||
" call Decho("exe NetrwKeepj put ='".ft.'/'.filename."'",'~'.expand("<slnum>"))
|
||||
" call Decho("exe NetrwKeepj put ='".ft.'/'.pfile."'",'~'.expand("<slnum>"))
|
||||
let ftpfile= ft.'/'.pfile
|
||||
sil! NetrwKeepj put=ftpfile
|
||||
|
||||
@ -10903,7 +10932,7 @@ fun! s:LocalListing()
|
||||
" call Decho("exe NetrwKeepj put ='".pfile."'",'~'.expand("<slnum>"))
|
||||
sil! NetrwKeepj put=pfile
|
||||
endif
|
||||
" call DechoBuf(bufnr("%"),"COMBAK#2")
|
||||
" call DechoBuf(bufnr("%"),"bufnr(%)")
|
||||
endfor
|
||||
|
||||
" cleanup any windows mess at end-of-line
|
||||
@ -10950,9 +10979,10 @@ fun! s:NetrwLocalRename(path) range
|
||||
" call Dfunc("NetrwLocalRename(path<".a:path.">)")
|
||||
|
||||
" preparation for removing multiple files/directories
|
||||
let ykeep = @@
|
||||
let ctr = a:firstline
|
||||
let svpos = winsaveview()
|
||||
let ykeep = @@
|
||||
let ctr = a:firstline
|
||||
let svpos = winsaveview()
|
||||
let all = 0
|
||||
" call Decho("saving posn to svpos<".string(svpos).">",'~'.expand("<slnum>"))
|
||||
|
||||
" rename files given by the markfilelist
|
||||
@ -10980,6 +11010,23 @@ fun! s:NetrwLocalRename(path) range
|
||||
let newname = substitute(oldname,subfrom,subto,'')
|
||||
endif
|
||||
endif
|
||||
if !all && filereadable(newname)
|
||||
call inputsave()
|
||||
let response= input("File<".newname."> already exists; do you want to overwrite it? (y/all/n) ")
|
||||
call inputrestore()
|
||||
if response == "all"
|
||||
let all= 1
|
||||
elseif response != "y" && response != "yes"
|
||||
" refresh the directory
|
||||
" call Decho("refresh the directory listing",'~'.expand("<slnum>"))
|
||||
NetrwKeepj call s:NetrwRefresh(1,s:NetrwBrowseChgDir(1,'./'))
|
||||
" call Decho("restoring posn to svpos<".string(svpos).">",'~'.expand("<slnum>"))
|
||||
NetrwKeepj call winrestview(svpos)
|
||||
let @@= ykeep
|
||||
" call Dret("NetrwLocalRename")
|
||||
return
|
||||
endif
|
||||
endif
|
||||
call rename(oldname,newname)
|
||||
endfor
|
||||
call s:NetrwUnmarkList(bufnr("%"),b:netrw_curdir)
|
||||
@ -11003,14 +11050,14 @@ fun! s:NetrwLocalRename(path) range
|
||||
|
||||
NetrwKeepj norm! 0
|
||||
let oldname= s:ComposePath(a:path,curword)
|
||||
" call Decho("oldname<".oldname.">",'~'.expand("<slnum>"))
|
||||
" call Decho("oldname<".oldname.">",'~'.expand("<slnum>"))
|
||||
|
||||
call inputsave()
|
||||
let newname= input("Moving ".oldname." to : ",substitute(oldname,'/*$','','e'))
|
||||
call inputrestore()
|
||||
|
||||
call rename(oldname,newname)
|
||||
" call Decho("renaming <".oldname."> to <".newname.">",'~'.expand("<slnum>"))
|
||||
" call Decho("renaming <".oldname."> to <".newname.">",'~'.expand("<slnum>"))
|
||||
|
||||
let ctr= ctr + 1
|
||||
endwhile
|
||||
@ -11220,7 +11267,9 @@ fun! netrw#Expose(varname)
|
||||
" call Dfunc("netrw#Expose(varname<".a:varname.">)")
|
||||
if exists("s:".a:varname)
|
||||
exe "let retval= s:".a:varname
|
||||
" call Decho("retval=".retval,'~'.expand("<slnum>"))
|
||||
if exists("g:netrw_pchk")
|
||||
" call Decho("type(g:netrw_pchk=".g:netrw_pchk.")=".type(retval),'~'.expand("<slnum>"))
|
||||
if type(retval) == 3
|
||||
let retval = copy(retval)
|
||||
let i = 0
|
||||
@ -11229,10 +11278,13 @@ fun! netrw#Expose(varname)
|
||||
let i = i + 1
|
||||
endwhile
|
||||
endif
|
||||
" call Dret("netrw#Expose ".string(retval))
|
||||
" call Dret("netrw#Expose ".string(retval)),'~'.expand("<slnum>"))
|
||||
return string(retval)
|
||||
else
|
||||
" call Decho("g:netrw_pchk doesn't exist",'~'.expand("<slnum>"))
|
||||
endif
|
||||
else
|
||||
" call Decho("s:".a:varname." doesn't exist",'~'.expand("<slnum>"))
|
||||
let retval= "n/a"
|
||||
endif
|
||||
|
||||
@ -11793,6 +11845,9 @@ fun! s:NetrwExe(cmd)
|
||||
" call Decho("exe ".a:cmd,'~'.expand("<slnum>"))
|
||||
exe a:cmd
|
||||
endif
|
||||
if v:shell_error
|
||||
call netrw#ErrorMsg(s:WARNING,"shell signalled an error",106)
|
||||
endif
|
||||
" call Dret("s:NetrwExe : v:shell_error=".v:shell_error)
|
||||
endfun
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
" netrwSettings.vim: makes netrw settings simpler
|
||||
" Date: Nov 09, 2016
|
||||
" Maintainer: Charles E Campbell <drchipNOSPAM at campbellfamily dot biz>
|
||||
" Maintainer: Charles E Campbell <NcampObell@SdrPchip.AorgM-NOSPAM>
|
||||
" Version: 16
|
||||
" Copyright: Copyright (C) 1999-2007 Charles E. Campbell {{{1
|
||||
" Permission is hereby granted to use and distribute this code,
|
||||
|
@ -18,61 +18,5 @@
|
||||
" holder be liable for any damages resulting from the use
|
||||
" of this software.
|
||||
function! netrw_gitignore#Hide(...)
|
||||
let additional_files = a:000
|
||||
|
||||
let default_files = ['.gitignore', '.git/info/exclude']
|
||||
|
||||
" get existing global/system gitignore files
|
||||
let global_gitignore = expand(substitute(system("git config --global core.excludesfile"), '\n', '', 'g'))
|
||||
if global_gitignore !=# ''
|
||||
let default_files = add(default_files, global_gitignore)
|
||||
endif
|
||||
let system_gitignore = expand(substitute(system("git config --system core.excludesfile"), '\n', '', 'g'))
|
||||
if system_gitignore !=# ''
|
||||
let default_files = add(default_files, system_gitignore)
|
||||
endif
|
||||
|
||||
" append additional files if given as function arguments
|
||||
if additional_files !=# []
|
||||
let files = extend(default_files, additional_files)
|
||||
else
|
||||
let files = default_files
|
||||
endif
|
||||
|
||||
" keep only existing/readable files
|
||||
let gitignore_files = []
|
||||
for file in files
|
||||
if filereadable(file)
|
||||
let gitignore_files = add(gitignore_files, file)
|
||||
endif
|
||||
endfor
|
||||
|
||||
" get contents of gitignore patterns from those files
|
||||
let gitignore_lines = []
|
||||
for file in gitignore_files
|
||||
for line in readfile(file)
|
||||
" filter empty lines and comments
|
||||
if line !~# '^#' && line !~# '^$'
|
||||
let gitignore_lines = add(gitignore_lines, line)
|
||||
endif
|
||||
endfor
|
||||
endfor
|
||||
|
||||
" convert gitignore patterns to Netrw/Vim regex patterns
|
||||
let escaped_lines = []
|
||||
for line in gitignore_lines
|
||||
let escaped = line
|
||||
let escaped = substitute(escaped, '\*\*', '*', 'g')
|
||||
let escaped = substitute(escaped, '\.', '\\.', 'g')
|
||||
let escaped = substitute(escaped, '\$', '\\$', 'g')
|
||||
let escaped = substitute(escaped, '*', '.*', 'g')
|
||||
" correction: dot, dollar and asterisks chars shouldn't be escaped when
|
||||
" within regex matching groups.
|
||||
let escaped = substitute(escaped, '\(\[[^]]*\)\zs\\\.', '\.', 'g')
|
||||
let escaped = substitute(escaped, '\(\[[^]]*\)\zs\\\$', '\$', 'g')
|
||||
let escaped = substitute(escaped, '\(\[[^]]*\)\zs\.\*', '*', 'g')
|
||||
let escaped_lines = add(escaped_lines, escaped)
|
||||
endfor
|
||||
|
||||
return join(escaped_lines, ',')
|
||||
return substitute(substitute(system('git ls-files --other --ignored --exclude-standard --directory'), '\n', ',', 'g'), ',$', '', '')
|
||||
endfunction
|
||||
|
@ -1,9 +1,9 @@
|
||||
*pi_netrw.txt* For Vim version 8.1. Last change: 2019 Jul 17
|
||||
*pi_netrw.txt* For Vim version 8.2. Last change: 2020 Aug 15
|
||||
|
||||
------------------------------------------------
|
||||
NETRW REFERENCE MANUAL by Charles E. Campbell
|
||||
------------------------------------------------
|
||||
Author: Charles E. Campbell <NdrOchip@ScampbellPfamily.AbizM>
|
||||
Author: Charles E. Campbell <NcampObell@SdrPchip.AorgM-NOSPAM>
|
||||
(remove NOSPAM from Campbell's email first)
|
||||
|
||||
Copyright: Copyright (C) 2017 Charles E Campbell *netrw-copyright*
|
||||
@ -1565,8 +1565,8 @@ So, for example: >
|
||||
file.rcs,v -> NFH_rcsCOMMAv()
|
||||
<
|
||||
If more such translations are necessary, please send me email: >
|
||||
NdrOchip at ScampbellPfamily.AbizM - NOSPAM
|
||||
with a request.
|
||||
NcampObell@SdrPchip.AorgM-NOSPAM
|
||||
with a request. (remove the embedded NOSPAM first)
|
||||
|
||||
Associated setting variable: |g:netrw_browsex_viewer|
|
||||
|
||||
@ -3054,7 +3054,7 @@ your browsing preferences. (see also: |netrw-settings|)
|
||||
(see |netrw-c-tab|).
|
||||
|
||||
*g:netrw_xstrlen* Controls how netrw computes string lengths,
|
||||
including multi-byte characters' string
|
||||
including multibyte characters' string
|
||||
length. (thanks to N Weibull, T Mechelynck)
|
||||
=0: uses Vim's built-in strlen()
|
||||
=1: number of codepoints (Latin a + combining
|
||||
@ -3229,7 +3229,8 @@ If there are marked files: (see |netrw-mf|)
|
||||
R [query: reply with s/^\(.*\)\.c$/\1.cpp/]
|
||||
<
|
||||
This example will mark all *.c files and then rename them to *.cpp
|
||||
files.
|
||||
files. Netrw will protect you from overwriting local files without
|
||||
confirmation, but not remote ones.
|
||||
|
||||
The ctrl-X character has special meaning for renaming files: >
|
||||
|
||||
@ -3512,7 +3513,7 @@ Example: Clear netrw's marked file list via a mapping on gu >
|
||||
- Click "Add..."
|
||||
- Set External Editor (adjust path as needed, include
|
||||
the quotes and !.! at the end):
|
||||
"c:\Program Files\Vim\vim70\gvim.exe" !.!
|
||||
"c:\Program Files\Vim\vim82\gvim.exe" !.!
|
||||
- Check that the filetype in the box below is
|
||||
{asterisk}.{asterisk} (all files), or whatever types
|
||||
you want (cec: change {asterisk} to * ; I had to
|
||||
@ -3762,8 +3763,8 @@ by obtaining a copy of the latest (often developmental) netrw at:
|
||||
|
||||
The <netrw.vim> script is typically installed on systems as something like:
|
||||
>
|
||||
/usr/local/share/vim/vim7x/plugin/netrwPlugin.vim
|
||||
/usr/local/share/vim/vim7x/autoload/netrw.vim
|
||||
/usr/local/share/vim/vim8x/plugin/netrwPlugin.vim
|
||||
/usr/local/share/vim/vim8x/autoload/netrw.vim
|
||||
(see output of :echo &rtp)
|
||||
<
|
||||
which is loaded automatically at startup (assuming :set nocp). If you
|
||||
@ -3836,12 +3837,30 @@ netrw:
|
||||
|
||||
Please send that information to <netrw.vim>'s maintainer along
|
||||
with the o/s you're using and the vim version that you're using
|
||||
(see |:version|) >
|
||||
NdrOchip at ScampbellPfamily.AbizM - NOSPAM
|
||||
(see |:version|) (remove the embedded NOSPAM first) >
|
||||
NcampObell@SdrPchip.AorgM-NOSPAM
|
||||
<
|
||||
==============================================================================
|
||||
12. History *netrw-history* {{{1
|
||||
|
||||
v169: Dec 20, 2019 * (reported by amkarthik) that netrw's x
|
||||
(|netrw-x|) would throw an error when
|
||||
attempting to open a local directory.
|
||||
v168: Dec 12, 2019 * scp timeout error message not reported,
|
||||
hopefully now fixed (Shane Xb Qian)
|
||||
|
||||
v167: Nov 29, 2019 * netrw does a save&restore on @* and @+.
|
||||
That causes problems with the clipboard.
|
||||
Now restores occurs only if @* or @+ have
|
||||
been changed.
|
||||
* netrw will change @* or @+ less often.
|
||||
Never if I happen to have caught all the
|
||||
operations that modify the unnamed
|
||||
register (which also writes @*).
|
||||
* Modified hiding behavior so that "s"
|
||||
will not ignore hiding.
|
||||
v166: Nov 06, 2019 * Removed a space from a nmap for "-"
|
||||
* Numerous debugging statement changes
|
||||
v163: Dec 05, 2017 * (Cristi Balan) reported that a setting ('sel')
|
||||
was left changed
|
||||
* (Holger Mitschke) reported a problem with
|
||||
@ -3852,6 +3871,8 @@ netrw:
|
||||
* (Holger Mitschke) amended this help file
|
||||
with additional |g:netrw_special_syntax|
|
||||
items
|
||||
* Prioritized wget over curl for
|
||||
g:netrw_http_cmd
|
||||
v162: Sep 19, 2016 * (haya14busa) pointed out two syntax errors
|
||||
with a patch; these are now fixed.
|
||||
Oct 26, 2016 * I started using mate-terminal and found that
|
||||
@ -4265,7 +4286,7 @@ netrw:
|
||||
Vim editor by Bram Moolenaar (Thanks, Bram!)
|
||||
dav support by C Campbell
|
||||
fetch support by Bram Moolenaar and C Campbell
|
||||
ftp support by C Campbell <NdrOchip@ScampbellPfamily.AbizM>
|
||||
ftp support by C Campbell <NcampObell@SdrPchip.AorgM-NOSPAM>
|
||||
http support by Bram Moolenaar <bram@moolenaar.net>
|
||||
rcp
|
||||
rsync support by C Campbell (suggested by Erik Warendorph)
|
||||
|
@ -1,7 +1,7 @@
|
||||
" netrwPlugin.vim: Handles file transfer and remote directory listing across a network
|
||||
" PLUGIN SECTION
|
||||
" Date: Feb 08, 2016
|
||||
" Maintainer: Charles E Campbell <NdrOchip@ScampbellPfamily.AbizM-NOSPAM>
|
||||
" Date: Feb 08, 2016 - Jan 07, 2020
|
||||
" Maintainer: Charles E Campbell <NcampObell@SdrPchip.AorgM-NOSPAM>
|
||||
" GetLatestVimScripts: 1075 1 :AutoInstall: netrw.vim
|
||||
" Copyright: Copyright (C) 1999-2013 Charles E. Campbell {{{1
|
||||
" Permission is hereby granted to use and distribute this code,
|
||||
@ -20,7 +20,7 @@
|
||||
if &cp || exists("g:loaded_netrwPlugin")
|
||||
finish
|
||||
endif
|
||||
let g:loaded_netrwPlugin = "v165"
|
||||
let g:loaded_netrwPlugin = "v168"
|
||||
let s:keepcpo = &cpo
|
||||
set cpo&vim
|
||||
"DechoRemOn
|
||||
@ -81,7 +81,7 @@ if !exists("g:netrw_nogx")
|
||||
if !hasmapto('<Plug>NetrwBrowseX')
|
||||
nmap <unique> gx <Plug>NetrwBrowseX
|
||||
endif
|
||||
nno <silent> <Plug>NetrwBrowseX :call netrw#BrowseX(expand((exists("g:netrw_gx")? g:netrw_gx : '<cfile>')),netrw#CheckIfRemote())<cr>
|
||||
nno <silent> <Plug>NetrwBrowseX :call netrw#BrowseX(netrw#GX(),netrw#CheckIfRemote(netrw#GX()))<cr>
|
||||
endif
|
||||
if maparg('gx','v') == ""
|
||||
if !hasmapto('<Plug>NetrwBrowseXVis')
|
||||
|
@ -1,7 +1,7 @@
|
||||
" Language : Netrw Listing Syntax
|
||||
" Maintainer : Charles E. Campbell
|
||||
" Last change: Oct 31, 2016
|
||||
" Version : 20 NOT RELEASED
|
||||
" Last change: Nov 07, 2019
|
||||
" Version : 20
|
||||
" ---------------------------------------------------------------------
|
||||
if exists("b:current_syntax")
|
||||
finish
|
||||
|
Loading…
Reference in New Issue
Block a user