runtime/netrw: 2963456ff2b740244b3a064785fe681b1998d75e

Port netrw files for release v168 only.
This commit is contained in:
Jan Edmund Lazo
2021-02-16 07:51:25 -05:00
parent 8d2c76c80c
commit 44ba77e589
4 changed files with 65 additions and 57 deletions

View File

@@ -1,8 +1,8 @@
" netrw.vim: Handles file transfer and remote directory listing across " netrw.vim: Handles file transfer and remote directory listing across
" AUTOLOAD SECTION " AUTOLOAD SECTION
" Date: Nov 29, 2019 " Date: Jan 07, 2020
" Version: 167 " Version: 168
" Maintainer: Charles E Campbell <NdrOchip@ScampbellPfamily.AbizM-NOSPAM> " Maintainer: Charles E Campbell <NcampObell@SdrPchip.AorgM-NOSPAM>
" GetLatestVimScripts: 1075 1 :AutoInstall: netrw.vim " GetLatestVimScripts: 1075 1 :AutoInstall: netrw.vim
" Copyright: Copyright (C) 2016 Charles E. Campbell {{{1 " Copyright: Copyright (C) 2016 Charles E. Campbell {{{1
" Permission is hereby granted to use and distribute this code, " Permission is hereby granted to use and distribute this code,
@@ -43,7 +43,7 @@ if exists("s:needspatches")
endfor endfor
endif endif
let g:loaded_netrw = "v167" let g:loaded_netrw = "v168"
if !exists("s:NOTE") if !exists("s:NOTE")
let s:NOTE = 0 let s:NOTE = 0
let s:WARNING = 1 let s:WARNING = 1
@@ -68,7 +68,7 @@ setl cpo&vim
" Usage: netrw#ErrorMsg(s:NOTE | s:WARNING | s:ERROR,"some message",error-number) " 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) " netrw#ErrorMsg(s:NOTE | s:WARNING | s:ERROR,["message1","message2",...],error-number)
" (this function can optionally take a list of messages) " (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) 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) " call Dfunc("netrw#ErrorMsg(level=".a:level." msg<".a:msg."> errnum=".a:errnum.") g:netrw_use_errorwindow=".g:netrw_use_errorwindow)
@@ -447,23 +447,9 @@ if !exists("g:netrw_localmovecmd")
let g:netrw_localmovecmd= "" let g:netrw_localmovecmd= ""
endif endif
endif endif
if v:version < 704 || (v:version == 704 && !has("patch1107")) " following serves as an example for how to insert a version&patch specific test
" 1109 provides for delete(tmpdir,"d") which is what will be used "if v:version < 704 || (v:version == 704 && !has("patch1107"))
if exists("g:netrw_local_rmdir") "endif
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
call s:NetrwInit("g:netrw_liststyle" , s:THINLIST) call s:NetrwInit("g:netrw_liststyle" , s:THINLIST)
" sanity checks " sanity checks
if g:netrw_liststyle < 0 || g:netrw_liststyle >= s:MAXLIST if g:netrw_liststyle < 0 || g:netrw_liststyle >= s:MAXLIST
@@ -5173,8 +5159,8 @@ fun! netrw#BrowseX(fname,remote)
if a:remote == 0 && isdirectory(a:fname) if a:remote == 0 && isdirectory(a:fname)
" if its really just a local directory, then do a "gf" instead " 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("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 gf instead",'~'.expand("<slnum>")) " call Decho("..appears to be a local directory; using e ".a:fname." instead",'~'.expand("<slnum>"))
norm! gf exe "e ".a:fname
" call Dret("netrw#BrowseX") " call Dret("netrw#BrowseX")
return return
elseif a:remote == 1 && a:fname !~ '^https\=:' && a:fname =~ '/$' elseif a:remote == 1 && a:fname !~ '^https\=:' && a:fname =~ '/$'
@@ -7119,17 +7105,8 @@ fun! s:NetrwMarkFileCopy(islocal,...)
" call Dret("s:NetrwMarkFileCopy : lcd failure") " call Dret("s:NetrwMarkFileCopy : lcd failure")
return return
endif endif
if v:version < 704 || (v:version == 704 && !has("patch1107")) if delete(tmpdir,"d")
call s:NetrwExe("sil !".g:netrw_localrmdir.g:netrw_localrmdiropt." ".s:ShellEscape(tmpdir,1)) call netrw#ErrorMsg(s:ERROR,"unable to delete directory <".tmpdir.">!",103)
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
endif endif
else else
if s:NetrwLcd(curdir) if s:NetrwLcd(curdir)
@@ -9548,6 +9525,7 @@ fun! s:NetrwWideListing()
" call Decho("setl ma noro",'~'.expand("<slnum>")) " call Decho("setl ma noro",'~'.expand("<slnum>"))
let b:netrw_cpf= 0 let b:netrw_cpf= 0
if line("$") >= w:netrw_bannercnt 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' exe 'sil NetrwKeepj '.w:netrw_bannercnt.',$g/^./if virtcol("$") > b:netrw_cpf|let b:netrw_cpf= virtcol("$")|endif'
NetrwKeepj call histdel("/",-1) NetrwKeepj call histdel("/",-1)
else else
@@ -9555,6 +9533,7 @@ fun! s:NetrwWideListing()
" call Dret("NetrwWideListing") " call Dret("NetrwWideListing")
return return
endif endif
" allow for two spaces to separate columns
let b:netrw_cpf= b:netrw_cpf + 2 let b:netrw_cpf= b:netrw_cpf + 2
" call Decho("b:netrw_cpf=max_filename_length+2=".b:netrw_cpf,'~'.expand("<slnum>")) " call Decho("b:netrw_cpf=max_filename_length+2=".b:netrw_cpf,'~'.expand("<slnum>"))
@@ -9577,10 +9556,11 @@ fun! s:NetrwWideListing()
if newcolend > line("$") | let newcolend= line("$") | endif if newcolend > line("$") | let newcolend= line("$") | endif
let newcolqty= newcolend - newcolstart let newcolqty= newcolend - newcolstart
exe newcolstart exe newcolstart
" COMBAK: both of the visual-mode using lines below are problematic vis-a-vis @*
if newcolqty == 0 if newcolqty == 0
exe "sil! NetrwKeepj norm! 0\<c-v>$h\"ax".w:netrw_bannercnt."G$\"ap" exe "sil! NetrwKeepj norm! 0\<c-v>$h\"ax".w:netrw_bannercnt."G$\"ap"
else else
exe "sil! NetrwKeepj norm! 0\<c-v>".newcolqty.'j$h\"ax'.w:netrw_bannercnt.'G$\"ap' exe "sil! NetrwKeepj norm! 0\<c-v>".newcolqty.'j$h"ax'.w:netrw_bannercnt.'G$"ap'
endif endif
exe "sil! NetrwKeepj ".newcolstart.','.newcolend.'d _' exe "sil! NetrwKeepj ".newcolstart.','.newcolend.'d _'
exe 'sil! NetrwKeepj '.w:netrw_bannercnt exe 'sil! NetrwKeepj '.w:netrw_bannercnt
@@ -10999,9 +10979,10 @@ fun! s:NetrwLocalRename(path) range
" call Dfunc("NetrwLocalRename(path<".a:path.">)") " call Dfunc("NetrwLocalRename(path<".a:path.">)")
" preparation for removing multiple files/directories " preparation for removing multiple files/directories
let ykeep = @@ let ykeep = @@
let ctr = a:firstline let ctr = a:firstline
let svpos = winsaveview() let svpos = winsaveview()
let all = 0
" call Decho("saving posn to svpos<".string(svpos).">",'~'.expand("<slnum>")) " call Decho("saving posn to svpos<".string(svpos).">",'~'.expand("<slnum>"))
" rename files given by the markfilelist " rename files given by the markfilelist
@@ -11029,6 +11010,23 @@ fun! s:NetrwLocalRename(path) range
let newname = substitute(oldname,subfrom,subto,'') let newname = substitute(oldname,subfrom,subto,'')
endif endif
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) call rename(oldname,newname)
endfor endfor
call s:NetrwUnmarkList(bufnr("%"),b:netrw_curdir) call s:NetrwUnmarkList(bufnr("%"),b:netrw_curdir)
@@ -11052,14 +11050,14 @@ fun! s:NetrwLocalRename(path) range
NetrwKeepj norm! 0 NetrwKeepj norm! 0
let oldname= s:ComposePath(a:path,curword) let oldname= s:ComposePath(a:path,curword)
" call Decho("oldname<".oldname.">",'~'.expand("<slnum>")) " call Decho("oldname<".oldname.">",'~'.expand("<slnum>"))
call inputsave() call inputsave()
let newname= input("Moving ".oldname." to : ",substitute(oldname,'/*$','','e')) let newname= input("Moving ".oldname." to : ",substitute(oldname,'/*$','','e'))
call inputrestore() call inputrestore()
call rename(oldname,newname) call rename(oldname,newname)
" call Decho("renaming <".oldname."> to <".newname.">",'~'.expand("<slnum>")) " call Decho("renaming <".oldname."> to <".newname.">",'~'.expand("<slnum>"))
let ctr= ctr + 1 let ctr= ctr + 1
endwhile endwhile
@@ -11847,6 +11845,9 @@ fun! s:NetrwExe(cmd)
" call Decho("exe ".a:cmd,'~'.expand("<slnum>")) " call Decho("exe ".a:cmd,'~'.expand("<slnum>"))
exe a:cmd exe a:cmd
endif 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) " call Dret("s:NetrwExe : v:shell_error=".v:shell_error)
endfun endfun

View File

@@ -1,6 +1,6 @@
" netrwSettings.vim: makes netrw settings simpler " netrwSettings.vim: makes netrw settings simpler
" Date: Nov 09, 2016 " Date: Nov 09, 2016
" Maintainer: Charles E Campbell <drchipNOSPAM at campbellfamily dot biz> " Maintainer: Charles E Campbell <NcampObell@SdrPchip.AorgM-NOSPAM>
" Version: 16 " Version: 16
" Copyright: Copyright (C) 1999-2007 Charles E. Campbell {{{1 " Copyright: Copyright (C) 1999-2007 Charles E. Campbell {{{1
" Permission is hereby granted to use and distribute this code, " Permission is hereby granted to use and distribute this code,

View File

@@ -1,9 +1,9 @@
*pi_netrw.txt* For Vim version 8.1. Last change: 2019 Dec 10 *pi_netrw.txt* For Vim version 8.2. Last change: 2020 Jan 07
------------------------------------------------ ------------------------------------------------
NETRW REFERENCE MANUAL by Charles E. Campbell 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) (remove NOSPAM from Campbell's email first)
Copyright: Copyright (C) 2017 Charles E Campbell *netrw-copyright* Copyright: Copyright (C) 2017 Charles E Campbell *netrw-copyright*
@@ -1184,7 +1184,7 @@ One may easily "bookmark" the currently browsed directory by using >
*.netrwbook* *.netrwbook*
Bookmarks are retained in between sessions of vim in a file called .netrwbook Bookmarks are retained in between sessions of vim in a file called .netrwbook
as a |List|, which is typically stored in the first directory on the user's as a |List|, which is typically stored in the first directory on the user's
'runtimepath'; entries are kept in sorted order. runtimepath; entries are kept in sorted order.
If there are marked files and/or directories, mb will add them to the bookmark If there are marked files and/or directories, mb will add them to the bookmark
list. list.
@@ -1565,8 +1565,8 @@ So, for example: >
file.rcs,v -> NFH_rcsCOMMAv() file.rcs,v -> NFH_rcsCOMMAv()
< <
If more such translations are necessary, please send me email: > If more such translations are necessary, please send me email: >
NdrOchip at ScampbellPfamily.AbizM - NOSPAM NcampObell@SdrPchip.AorgM-NOSPAM
with a request. with a request. (remove the embedded NOSPAM first)
Associated setting variable: |g:netrw_browsex_viewer| Associated setting variable: |g:netrw_browsex_viewer|
@@ -3229,7 +3229,8 @@ If there are marked files: (see |netrw-mf|)
R [query: reply with s/^\(.*\)\.c$/\1.cpp/] R [query: reply with s/^\(.*\)\.c$/\1.cpp/]
< <
This example will mark all *.c files and then rename them to *.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: > 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..." - Click "Add..."
- Set External Editor (adjust path as needed, include - Set External Editor (adjust path as needed, include
the quotes and !.! at the end): the quotes and !.! at the end):
"c:\Program Files\Vim\vim81\gvim.exe" !.! "c:\Program Files\Vim\vim70\gvim.exe" !.!
- Check that the filetype in the box below is - Check that the filetype in the box below is
{asterisk}.{asterisk} (all files), or whatever types {asterisk}.{asterisk} (all files), or whatever types
you want (cec: change {asterisk} to * ; I had to 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: The <netrw.vim> script is typically installed on systems as something like:
> >
/usr/local/share/vim/vim8x/plugin/netrwPlugin.vim /usr/local/share/vim/vim7x/plugin/netrwPlugin.vim
/usr/local/share/vim/vim8x/autoload/netrw.vim /usr/local/share/vim/vim7x/autoload/netrw.vim
(see output of :echo &rtp) (see output of :echo &rtp)
< <
which is loaded automatically at startup (assuming :set nocp). If you which is loaded automatically at startup (assuming :set nocp). If you
@@ -3836,12 +3837,18 @@ netrw:
Please send that information to <netrw.vim>'s maintainer along 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 with the o/s you're using and the vim version that you're using
(see |:version|) > (see |:version|) (remove the embedded NOSPAM first) >
NdrOchip at ScampbellPfamily.AbizM - NOSPAM NcampObell@SdrPchip.AorgM-NOSPAM
< <
============================================================================== ==============================================================================
12. History *netrw-history* {{{1 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 @+. v167: Nov 29, 2019 * netrw does a save&restore on @* and @+.
That causes problems with the clipboard. That causes problems with the clipboard.
Now restores occurs only if @* or @+ have Now restores occurs only if @* or @+ have
@@ -4279,7 +4286,7 @@ netrw:
Vim editor by Bram Moolenaar (Thanks, Bram!) Vim editor by Bram Moolenaar (Thanks, Bram!)
dav support by C Campbell dav support by C Campbell
fetch support by Bram Moolenaar and 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> http support by Bram Moolenaar <bram@moolenaar.net>
rcp rcp
rsync support by C Campbell (suggested by Erik Warendorph) rsync support by C Campbell (suggested by Erik Warendorph)

View File

@@ -1,7 +1,7 @@
" netrwPlugin.vim: Handles file transfer and remote directory listing across a network " netrwPlugin.vim: Handles file transfer and remote directory listing across a network
" PLUGIN SECTION " PLUGIN SECTION
" Date: Feb 08, 2016 " Date: Feb 08, 2016 - Jan 07, 2020
" Maintainer: Charles E Campbell <NdrOchip@ScampbellPfamily.AbizM-NOSPAM> " Maintainer: Charles E Campbell <NcampObell@SdrPchip.AorgM-NOSPAM>
" GetLatestVimScripts: 1075 1 :AutoInstall: netrw.vim " GetLatestVimScripts: 1075 1 :AutoInstall: netrw.vim
" Copyright: Copyright (C) 1999-2013 Charles E. Campbell {{{1 " Copyright: Copyright (C) 1999-2013 Charles E. Campbell {{{1
" Permission is hereby granted to use and distribute this code, " Permission is hereby granted to use and distribute this code,
@@ -20,7 +20,7 @@
if &cp || exists("g:loaded_netrwPlugin") if &cp || exists("g:loaded_netrwPlugin")
finish finish
endif endif
let g:loaded_netrwPlugin = "v167" let g:loaded_netrwPlugin = "v168"
let s:keepcpo = &cpo let s:keepcpo = &cpo
set cpo&vim set cpo&vim
"DechoRemOn "DechoRemOn