vim do not guess $HOME when unavailable

A. J. Mechelynck antoine.mechelynck at
Mon Jan 23 10:20:46 UTC 2006

Pierre Habouzit wrote:
> [...] My only question was that I was surprised that 
> when HOME is not set, vim does not even try to read the login_dir field 
> of getpwuid, it's a simple guess, that can save a lot of trouble. 
> That's all.
> I only asked if there was a rationale behind this, or if it was just 
> `not done' and that a patch would be accepted.

IIUC, getpwuid() is Unix-specific; the equivalent on Windows would not
exist or be very different, wouldn't it? (not that I know what it would
be; $HOMEDRIVE$HOMEPATH maybe, i.e., in Windows notation,
%HOMEDRIVE%%HOMEPATH%). So if such a solution were to be implemented, I
guess that (considering ":help design-multi-platform") there would have
to be in some source file something similar (but probably not identical) to:

	[set homepath to $HOME]
	if ( homepath == '' )
		homepath = getpwuid().login_dir

But if $HOME is unset on Unix, wouldn't there be a lot of other things
which would fail? And if there would, wouldn't it be a better solution
to solve the problem across the board (by keeping $HOME defined in some
sensible manner) rather than for one software package (Vim)?

Best regards,

More information about the pkg-vim-maintainers mailing list