Note that there are some explanatory texts on larger screens.

plurals
  1. PORunning gvim from MSYS --- how to avoid/change MSYS enviroment variables?
    primarykey
    data
    text
    <p>When I run <code>gvim</code> from MSYS, things go wrong during initialization. Namely, <code>gvim</code> can't find the initialization files that are in '<code>C:\Documents and Settings\username\vimfiles</code>.</p> <p>[Specifically, gvim reports the error <code>E117: Unknown function: pathogen#infect</code> during initialization, so it never found <code>autoload\pathogen.vim</code>. Doing <code>:scriptnames</code> also confirms that none of the setup files from <code>vimfiles\</code> are run.]</p> <p>I think I've debugged why it goes wrong. When you start MSYS, the MSYS shell inherits the windows enviroment variables, but changes some of them to it's custom values. <code>C:\Documents and Settings\username</code> is the value of <code>$HOME</code> in Windows, but MSYS sets it to something like <code>C:/msys/user name</code>. And of course, Vim uses <code>$HOME</code> to find the right initialization files.</p> <p>I also notice <code>set shell?</code> has changed to something like <code>shell=C:/msys/bin/sh</code> instead of <code>shell=C:\WINDOWS\system32\cmd.exe</code>, but I hope this isn't important for fixing the initialization problem.</p> <p>I need to run gvim with the normal windows environment variables. At least I need to be able to manually override a few important ones like <code>$HOME</code> to something I specify (i.e., I'm not concerned about my windows <code>$HOME</code> changing, so it's fine to use a static value). </p> <p>I tried to reset <code>$HOME</code> manually in my vimrc, but by then it is too late.</p> <p>Is there some trick to specifying <code>$HOME</code> early on during initialization, or as an extra command line parameter?</p> <p>Alternatively, is there some trick with running commands from <code>msys</code> differently? I know almost nothing about how the shell <code>C:/msys/bin/sh</code> works, but I could conceive of some extra arguments that changes the visibile environment for the command (e.g. <code>gvim.exe</code>) you are typing.</p> <p><strong>---Edit---</strong><br> Reposting the solution that worked (it achieves the later idea): </p> <p>Instead of running <code>gvim.exe</code>, run the command <code>HOME="C:\Documents and Settings\username" gvim.exe</code></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload