1

I've installed GVim on my win7 machine but I'm having trouble with saving any files. I keep getting the

e212: Can't open file for writing

If I try to just quit with :q!, I get

e138: Can't write viminfo file C:\_viminfo

after which the gvim successfully closes

Basically I can't save any files. I've tried editing/creating files at a few random locations as well as both local and global _vimrc and none of those work. I suspect this is something to do with how permissions are handled on windows but I'm a bit clueless in this respect. Technically I've got admin rights so I'm not sure why GVim is struggling.

How do I make my GVim work?

P.S. If it's of any importance, there is no difference in whether I start GVim from the Start menu or from mintty/mingw or from cmd.

EDIT: It looks like my problem (or rather one of the problems) was that I didn't have a $HOME environment variable. Now, if I set it to C:/Users/, then I can get GVim to work inside C:/Users/ and its subdirectories, but not anywhere above. I tried setting C:/ as $HOME, but then I'm back to the original problem. I tried reinstalling Vim, making sure it's done with administrator privileges, installed it in C:/Vim rather than Program Files but still no luck. Running it only inside C:/Users/ is not a solution.

  • Your $HOME variable should be set by Vim automatically based on $HOMEDRIVE and $HOMEPATH. Are those variables getting properly set in your Windows environment? (See ":help $HOME") – Heptite May 1 '15 at 17:12
  • Also, if you manually set $HOME you should be setting it to C:\Users\username\, and not just C:\Users\ – Heptite May 1 '15 at 18:28
  • Do you have User Account Control enabled? With it, you're still prohibited from writing anywhere but your user directory, unless you launch Vim in elevated mode. – Ingo Karkat May 1 '15 at 19:19
  • @Heptite It was C:\Users\username, it's just a typo in my post. Thanks for the suggestions both you, I'll check them when I'm back in the office which is most likely only going to be Tuesday. – kbau May 2 '15 at 18:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.