From cad62f5ec6f9cd94590cfe9ebd1310246d9adb46 Mon Sep 17 00:00:00 2001 From: Jaehwang Jung Date: Sat, 13 Sep 2025 01:54:35 +0900 Subject: [PATCH] vim-patch:0bda783: runtime(netrw): upstream snapshot v184 This change includes the following upstream commits: - fix: remove black lines in directory listing - fix: correctly create new file when using Lexplore - refactor: remove print functionality The main highlight is removing print functionality that was broken both in neovim and vim. closes: vim/vim#17847 https://github.com/vim/vim/commit/0bda7830ac140d2a347fe81edc95314b020b7ca6 Co-authored-by: Luca Saccarola --- .../pack/dist/opt/netrw/autoload/netrw.vim | 73 +++---------------- .../dist/opt/netrw/plugin/netrwPlugin.vim | 2 +- 2 files changed, 11 insertions(+), 64 deletions(-) diff --git a/runtime/pack/dist/opt/netrw/autoload/netrw.vim b/runtime/pack/dist/opt/netrw/autoload/netrw.vim index 1ce9095134..480d8fc58b 100644 --- a/runtime/pack/dist/opt/netrw/autoload/netrw.vim +++ b/runtime/pack/dist/opt/netrw/autoload/netrw.vim @@ -19,7 +19,7 @@ if &cp || exists("g:loaded_netrw") finish endif -let g:loaded_netrw = "v181" +let g:loaded_netrw = "v184" if !has("patch-9.1.1054") && !has('nvim') echoerr 'netrw needs Vim v9.1.1054' @@ -4865,7 +4865,6 @@ function s:NetrwMaps(islocal) nnoremap mg :call NetrwMarkFileGrep(1) nnoremap mh :call NetrwMarkHideSfx(1) nnoremap mm :call NetrwMarkFileMove(1) - " nnoremap mp :call NetrwMarkFilePrint(1) nnoremap mr :call NetrwMarkFileRegexp(1) nnoremap ms :call NetrwMarkFileSource(1) nnoremap mT :call NetrwMarkFileTag(1) @@ -4977,7 +4976,6 @@ function s:NetrwMaps(islocal) nnoremap mg :call NetrwMarkFileGrep(0) nnoremap mh :call NetrwMarkHideSfx(0) nnoremap mm :call NetrwMarkFileMove(0) - " nnoremap mp :call NetrwMarkFilePrint(0) nnoremap mr :call NetrwMarkFileRegexp(0) nnoremap ms :call NetrwMarkFileSource(0) nnoremap mT :call NetrwMarkFileTag(0) @@ -5936,39 +5934,6 @@ function s:NetrwMarkFileMove(islocal) endfunction -" s:NetrwMarkFilePrint: (invoked by mp) This function prints marked files {{{2 -" using the hardcopy command. Local marked-file list only. -function s:NetrwMarkFilePrint(islocal) - let curbufnr= bufnr("%") - - " sanity check - if !exists("s:netrwmarkfilelist_{curbufnr}") || empty(s:netrwmarkfilelist_{curbufnr}) - call netrw#msg#Notify('ERROR', 'there are no marked files in this window (:help netrw-mf)') - return - endif - let curdir= s:NetrwGetCurdir(a:islocal) - - if exists("s:netrwmarkfilelist_{curbufnr}") - let netrwmarkfilelist = s:netrwmarkfilelist_{curbufnr} - call s:NetrwUnmarkList(curbufnr,curdir) - for fname in netrwmarkfilelist - if a:islocal - if g:netrw_keepdir - let fname= netrw#fs#ComposePath(curdir,fname) - endif - else - let fname= curdir.fname - endif - 1split - " the autocmds will handle both local and remote files - exe "sil NetrwKeepj e ".fnameescape(fname) - hardcopy - q - endfor - 2match none - endif -endfunction - " s:NetrwMarkFileRegexp: (invoked by mr) This function is used to mark {{{2 " files when given a regexp (for which a prompt is " issued) (matches to name of files). @@ -6199,37 +6164,20 @@ endfunction " s:NetrwOpenFile: query user for a filename and open it {{{2 function s:NetrwOpenFile(islocal) - let ykeep= @@ call inputsave() - let fname= input("Enter filename: ") + let fname = input("Enter filename: ") call inputrestore() - " determine if Lexplore is in use - if exists("t:netrw_lexbufnr") - " check if t:netrw_lexbufnr refers to a netrw window - let lexwinnr = bufwinnr(t:netrw_lexbufnr) - if lexwinnr != -1 && exists("g:netrw_chgwin") && g:netrw_chgwin != -1 - exe "NetrwKeepj keepalt ".g:netrw_chgwin."wincmd w" - exe "NetrwKeepj e ".fnameescape(fname) - let @@= ykeep - endif + if empty(fname) + return endif - " Does the filename contain a path? - if fname !~ '[/\\]' - if exists("b:netrw_curdir") - " save position for benefit of Rexplore - let s:rexposn_{bufnr("%")}= winsaveview() - if b:netrw_curdir =~ '/$' - exe "NetrwKeepj e ".fnameescape(b:netrw_curdir.fname) - else - exe "e ".fnameescape(b:netrw_curdir."/".fname) - endif - endif - else - exe "NetrwKeepj e ".fnameescape(fname) - endif - let @@= ykeep + " save position for benefit of Rexplore + let s:rexposn_{bufnr("%")}= winsaveview() + + execute "NetrwKeepj e " . fnameescape(!isabsolutepath(fname) + \ ? netrw#fs#ComposePath(b:netrw_curdir, fname) + \ : fname) endfunction " netrw#Shrink: shrinks/expands a netrw or Lexplorer window {{{2 @@ -6429,7 +6377,6 @@ function s:NetrwMenu(domenu) exe 'sil! menu '.g:NetrwMenuPriority.'.14.8 '.g:NetrwTopLvlMenu.'Marked\ Files.Exe\ Cmdmx mx' exe 'sil! menu '.g:NetrwMenuPriority.'.14.9 '.g:NetrwTopLvlMenu.'Marked\ Files.Move\ To\ Targetmm mm' exe 'sil! menu '.g:NetrwMenuPriority.'.14.10 '.g:NetrwTopLvlMenu.'Marked\ Files.ObtainO O' - exe 'sil! menu '.g:NetrwMenuPriority.'.14.11 '.g:NetrwTopLvlMenu.'Marked\ Files.Printmp mp' exe 'sil! menu '.g:NetrwMenuPriority.'.14.12 '.g:NetrwTopLvlMenu.'Marked\ Files.ReplaceR R' exe 'sil! menu '.g:NetrwMenuPriority.'.14.13 '.g:NetrwTopLvlMenu.'Marked\ Files.Set\ Targetmt mt' exe 'sil! menu '.g:NetrwMenuPriority.'.14.14 '.g:NetrwTopLvlMenu.'Marked\ Files.TagmT mT' diff --git a/runtime/pack/dist/opt/netrw/plugin/netrwPlugin.vim b/runtime/pack/dist/opt/netrw/plugin/netrwPlugin.vim index 799834ec5d..d2d16e6c1b 100644 --- a/runtime/pack/dist/opt/netrw/plugin/netrwPlugin.vim +++ b/runtime/pack/dist/opt/netrw/plugin/netrwPlugin.vim @@ -15,7 +15,7 @@ if &cp || exists("g:loaded_netrwPlugin") finish endif -let g:loaded_netrwPlugin = "v181" +let g:loaded_netrwPlugin = "v184" let s:keepcpo = &cpo set cpo&vim