Re: [vim/vim] Traversing directories in netrw quickly creates (and immediately deletes) swap files, changing the directories lastModifiedTime (Issue #18854)

3 views
Skip to first unread message

Christian Brabandt

unread,
2:23 AM (4 hours ago) 2:23 AM
to vim/vim, Subscribed
chrisbra left a comment (vim/vim#18854)

Changing the default value for 'directory' seems a bit drastic and is out of the question, as that has other unwanted effects (e.g. when several users edit the same file you won't notice it). The correct way is to configure your 'directory' setting as you did already.

It might be possible to modify netrw to not create swapfiles. I do not know offhand, if this is really possible, it could be that swapfiles will be created anyhow and disabling swapfiles within netrw might come too late, not sure yet.


Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/18854/3605442268@github.com>

David Alayachew

unread,
4:17 AM (2 hours ago) 4:17 AM
to vim/vim, Subscribed
davidalayachew left a comment (vim/vim#18854)

Thanks for the speedy response @chrisbra. I definitely didn't consider the multiple users point, ty vm.

It would be good if we could avoid creating swapfiles just for netrw. Though, I am more surprised that we make any in the first place.

Why does netrw make swapfiles? Through all the study and research that we did (in the linked StackExchange post), we were never able to catch the file long enough to read its contents.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/18854/3605840880@github.com>

Christian Brabandt

unread,
6:18 AM (9 minutes ago) 6:18 AM
to vim/vim, Subscribed
chrisbra left a comment (vim/vim#18854)

this is just a guess, I only had a quick look. Can you try this patch?

diff --git a/runtime/pack/dist/opt/netrw/autoload/netrw.vim b/runtime/pack/dist/opt/netrw/autoload/netrw.vim
index 5aa087afb..af58267fa 100644
--- a/runtime/pack/dist/opt/netrw/autoload/netrw.vim
+++ b/runtime/pack/dist/opt/netrw/autoload/netrw.vim
@@ -4256,12 +4256,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


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/18854/3606365820@github.com>

Reply all
Reply to author
Forward
0 new messages