I've created another domain user in Windows and I'm trying to run gvim from it.

I've created a %USERPROFILE%\_vimrc but when I start gvim and check :echo $HOME it's set to C:\Windows\system32.

I'd like to have different domain users with different _vimrc for different purposes, but if they all end up in C:\Windows\system32 I'll have to load them up individually, and that's useless.

So how do I set the $HOME directory to %USERPROFILE% even though I've started it using a different account?

  • 1
    Can you create a system environment variable $HOME/ %HOME% for those new users? If this variable is not available, Vim guesses and constructs it from $HOMEDRIVE and $HOMEPATH which may be wrong in your case Nov 1 '21 at 10:46
  • @ChristianBrabandt do you mean $ENV:HOME in Powershell?
    – leeand00
    Nov 1 '21 at 19:47
  • I do not know Powershell, so not sure if this is correct Nov 1 '21 at 20:07

Determined that I was missing about 5 user Environment variable for vim in that user's user profile:

  • MYVIMRC - Should be a path that points to the _vimrc file.
  • VIM - A path that points to the installed vim directory.
  • VIMRUNTIME - A path that points to the installed vim directory.
  • HOMEPATH - points to \Users\<username>
  • HOMEDRIVE - points to drive with user profiles C:

I had to login as the user to do this.

  • If HOME is set, vim should set those automatically i believe
    – D. Ben Knoble
    Nov 20 '21 at 12:31

Your Answer

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

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