Wednesday, June 30, 2021

Re: Prevent vim from polluting the file system with a bunch of temporary $HOME/.viminf[a-z] files

On 2021-06-30, Chris Jones wrote:
> No idea where these files come from or what they're for. I ended up
> grepping the reference manual for clues and am none the wiser. Internet
> searches also failed to give me an answer.
>
> Is there any way to tell vim NOT to create them in the first place?

It looks like the :wviminfo command will write those. See

:help :wv

Unfortunately, I couldn't find any explanation of why "old temp
files [would be] left behind", nor any other reference to "viminf*".

I looked in the source, viminfo.c. From a quick read, it looks like
Vim creates a temporary file with a name like that and uses it to
build the viminfo file. When Vim finishes building that file, it
renames it to the default ~/.viminfo or whatever name the user has
chosen via the -i command-line option or the 'viminfo' or
'viminfofile' options.

If that rename fails, Vim prints an error message and tries to
delete the temporary file.

The best way to avoid having those files laying around is to find
out why Vim is unable to rename them and fix that problem. Watch
for error messages when Vim closes.

HTH,
Gary

--
--
You received this message from the "vim_use" 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_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/20210701013009.GC22769%40phoenix.

No comments:

Post a Comment