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.![]()
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.![]()
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.![]()
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
Sorry for the delayed responses -- holidays.
How do I try this patch? Is there a build I download? Or is this a file that I have to edit in my workspace?
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
Okay, if you are not familiar with patches, let try to do it manually, that patch is not that hard to read. In principle you need to find the lines marked with a leading - and replace them with the line marked with a leading +. In your case, from within Vim try to edit :e $VIMRUNTIME/pack/dist/opt/netrw/autoload/netrw.vim then go to line 4256 (:4256) and add those 2 NetrwKeepj lines by adding the noswapfile modifier to it.
Depending on your system, you may need to run vim with admin privileges in order to edit a file within $VIMRUNTIME.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
Okay, if you are not familiar with patches, let try to do it manually, that patch is not that hard to read. In principle you need to find the lines marked with a leading
-and replace them with the line marked with a leading+. In your case, from within Vim try to edit:e $VIMRUNTIME/pack/dist/opt/netrw/autoload/netrw.vimthen go to line 4256 (:4256) and add those 2NetrwKeepjlines by adding thenoswapfilemodifier to it.
Depending on your system, you may need to run vim with admin privileges in order to edit a file within $VIMRUNTIME.
It worked! Ty vm. I only did some initial testing with it, but so far, no issues.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()