Is there a way to prevent Vim's netrw from modifying timestamp of directories I browse?

260 views Asked by At

Whenever I browse with the netrw 'Explore' command in linux, the directories that I browse through get their modified timestamps changed to when I last changed to that directory.

Is there a way to prevent it from updating the timestamps, since I haven't modified a file inside the directory (similar to how using ls to list and cd to change directories doesn't modify the timestamps of the directory)?

1

There are 1 answers

1
romainl On

I don't usually have that problem but I was able to replicate it by disabling my config. After a bit of experimentation, I tracked it down to swap files. set noswapfile is what prevents that behaviour in my setup so it should provide a quick solution to your problem.

But, if you want to keep the safety provided by that functionality, you can tell Vim to store swap files in a specific place with the :help 'directory' option.

Note that the Netrw documentation, as of v171, claims that it doesn't create swap files:

*g:netrw_use_noswf*     netrw normally avoids writing swapfiles
                        for browser buffers.  [...]

So it looks like a bug to me, that you should probably consider reporting.