runtime(netrw): Do not create swapfiles in netrw buffers

Commit: 
https://github.com/vim/vim/commit/4e2aafddbb6658a984bb6042026eb4ba5ee423d7
Author: Christian Brabandt <[email protected]>
Date:   Mon Jan 19 19:25:12 2026 +0000

    runtime(netrw): Do not create swapfiles in netrw buffers
    
    Problem:  When using netrw to navigate directories, vim immediately
              creates, then deletes a swap file in the entered directory,
              causing the lastModifiedTime of that directory to change.
    Solution: Use the :noswapfile command modifier in s:NetrwEditFile()
    
    fixes: #18854
    
    Signed-off-by: Christian Brabandt <[email protected]>

diff --git a/runtime/pack/dist/opt/netrw/autoload/netrw.vim 
b/runtime/pack/dist/opt/netrw/autoload/netrw.vim
index 0d73de9ac..7ec29a2c3 100644
--- a/runtime/pack/dist/opt/netrw/autoload/netrw.vim
+++ b/runtime/pack/dist/opt/netrw/autoload/netrw.vim
@@ -17,6 +17,7 @@
 " 2025 Nov 18 by Vim Project use UNC paths when using scp and Windows paths 
#18764
 " 2025 Nov 28 by Vim Project fix undefined variable in *NetrwMenu #18829
 " 2025 Dec 26 by Vim Project fix use of g:netrw_cygwin #19015
+" 2026 Jan 19 by Vim Project do not create swapfiles #18854
 " Copyright:  Copyright (C) 2016 Charles E. Campbell {{{1
 "             Permission is hereby granted to use and distribute this code,
 "             with or without modifications, provided that this copyright
@@ -4257,12 +4258,12 @@ endfunction
 "    NetrwKeepj [keepalt] <OPT> <CMD> <FILENAME>
 function s:NetrwEditFile(cmd,opt,fname)
     if exists("g:netrw_altfile") && g:netrw_altfile && &ft == "netrw"
-        exe "NetrwKeepj keepalt ".a:opt." ".a:cmd." ".fnameescape(a:fname)
+        exe "NetrwKeepj noswapfile keepalt ".a:opt." ".a:cmd." 
".fnameescape(a:fname)
     else
         if a:cmd =~# 'e\%[new]!' && !&hidden && getbufvar(bufname('%'), 
'&modified', 0)
             call setbufvar(bufname('%'), '&bufhidden', 'hide')
         endif
-        exe "NetrwKeepj ".a:opt." ".a:cmd." ".fnameescape(a:fname)
+        exe "NetrwKeepj noswapfile ".a:opt." ".a:cmd." ".fnameescape(a:fname)
     endif
 endfunction
 

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/vim_dev/E1vhuwt-003bDC-1W%40256bit.org.

Raspunde prin e-mail lui