Search notes:

VIM src/misc1.c

misc1.c contains functions that didn't seem to fit elsewhere. Compare with misc2.c.

vim_getenv()

vim_getenv is VIM's version of getenv().
The three variables $HOME, $VIM and $VIMRUNTIME are treated specially if the corresponding environment variable does not exist:
For HOME, the value of the global variable homedir is returned.

init_homedir()

init_homedir tries to determine the value for VIM's $HOME variable.
The value of $HOME will be set to that of the environment variable HOME, if available.
On Windows, there is typically no HOME environment variable. Therefore, if init_homedir finds no HOME environment variable on Windows, it tries to assign the concatenation of HOMEDRIVE and HOMEPATH to PATH. If this still fails, the value of %USERPROFILE% is assigned, etc.
If all fails, the value C:\ will be assigned.
The value that was determined is assigned to the global variable static char_u *homedir` (externally defined in globals.h).
init_homedir() might be called again if encoding changes.
The code of init_homedir is duplicated in dosinst.c (to be kept in sync…)

vim_version_dir()

vim_version_dir has one parameter, char_u *vimdir. The function checks if the directory vimdir/<version> or vimdir/runtime exists.
If it does not exist, the function returns NULL, otherwise, it returns the directory name in allocated memory.

vim_beep()

Beep…

Index