I am comforable with using history of edited files that is kept in viminfo, the one that sets the limit in the first setting of set viminfo='100,... variable.

After I've started using mutt as email client and using vim as its editor, and that makes multiple temporary files created in /tmp/dir. These are of no interest and spoil the history of :browse old. I am trying to figure out the way of excluding those so they could be skipped or at least wiped in some hook procedure. They all can be easily identified by /tmp/mutt-.* path regex.

Is there some natural/doable way to implement this?

2 Answers 2


I guess I found a good solution for my use case. -i option allows to specify alternative locoation of viminfo file. So I can specifey vim -i /tmp/blackhole for cases where I do not care of file history. In my case that is specifying

set editor = "vim -i /tmp/idontcare"

in my .muttrc


You can also use the r option. See :h viminfo-r:

r   Removable media.  The argument is a string (up to the next
    ',').  This parameter can be given several times.  Each
    specifies the start of a path for which no marks will be
    stored.  This is to avoid removable media.  For MS-DOS you
    could use "ra:,rb:", for Amiga "rdf0:,rdf1:,rdf2:".  You can
    also use it for temp files, e.g., for Unix: "r/tmp".  Case is
    ignored.  Maximum length of each 'r' argument is 50

So in your case you can use something like

set viminfo='100,<1000,s100,:100,r/tmp,n$HOME/.vim/viminfo

Make sure the r option is not at the end of the list, it will break viminfo for some reason.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.