vim do not guess $HOME when unavailable

A. J. Mechelynck antoine.mechelynck at
Mon Jan 23 08:51:26 UTC 2006

Pierre Habouzit wrote:
> One of our users reported that with HOME unset vim does not find the 
> users vimrc, because it only uses $HOME to find the vimrc :
> Is this intended (and if yes why) ? or shouldn't it use getpwuid to find 
> the information ?

If $HOME is unset, there is a fallback, which can IIUC be set at
compile-time, possibly in an architecture-dependent fashion. It is
mentioned in the ":version" listing as "2nd user vimrc file". For
instance, on many systems (but apparently not on Unix), if $HOME/.vimrc
and $HOME/_vimrc are not found, Vim will look for the same files in the
$VIM directory.

I suppose that on Unix/Linux, $HOME "ought" never to be unset. (What is
the logic behind unsetting it intentionally on Debian?)

About that Debian bug specifically (Vim fails within sudo because $HOME
is unset), is it really "good practice" to call vim within sudo? Or
shouldn't sudo (after you enter the root password) set HOME='/root' or
something like that? Or else leave $HOME unchanged? -- Well, now that it
is known, I suppose that a usable workaround (until the bug is fixed)
would be to login to root rather than use sudo. Of course it is just a
"temporary workaround", not a "permanent solution".

Best regards,

More information about the pkg-vim-maintainers mailing list