I just installed Vim and gVim, version 8.0.1026 under Windows 16 64bits.

Everything works well, except that the program(s) can't save any historical information about my usage (e.g. recent files, markers, command history). The reason, apparently, is the error that I keep receiving when exiting vim:

E886: Can't rename viminfo file to C:\Program Files (x86)\Vim\_viminfo!

I just checked and made sure that C:\Program Files (x86)\Vim\_viminfo is not ready-only and that I have all permissions to use it (I am working in my personal computer).

What could have been causing this?

  • You said you checked the permissions of the directory, but just to be sure have you tried giving another location to your viminfo file? With something like set viminfo+=nPATH/TO/HOME/DIR
    – statox
    Aug 31, 2017 at 15:53
  • 2
    known bug of patch 8.0.1012, will probably be fixed soon. Aug 31, 2017 at 18:34
  • 2
    fixed as of 8.0.1028 Aug 31, 2017 at 19:28

1 Answer 1


Writing to C:\Program Files (x86) usually requires admin privileges, so Vim won't be able to write there, unless it's run as Administrator. But running Vim as Administrator is a security risk, so you should try to avoid doing so unless necessary.

In this case, Administrator is really not necessary. From :help viminfo-file-name:

The default name of the viminfo file is [...] "$HOME\_viminfo" for
MS-DOS and Win32. [...] when $HOME is not set, "$VIM\_viminfo" is used.  
When $VIM is also not set, "c:\_viminfo" is used.

It sounds like you have $VIM set, but not $HOME. Setting $HOME in your environment variables to point to your home directory should solve the problem.

Alternatively, you can use statox's suggestion and specify an explicit location for the viminfo file:

The 'n' flag in the 'viminfo' option can be used to specify another viminfo
file name 'viminfo'.


set viminfo+=nC:\Users\name\viminfo

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.