Home Explore Blog CI



neovim

23th chunk of `runtime/doc/starting.txt`
f63803dec0b71e153a2dfb88270cb8c874407c7066f813410000000100000d94

understood as "$XDG_CONFIG_HOME or ~/.config".

CONFIG DIRECTORY (DEFAULT) ~
                  *$XDG_CONFIG_HOME*            Nvim: stdpath("config")
    Unix:         ~/.config                   ~/.config/nvim
    Windows:      ~/AppData/Local             ~/AppData/Local/nvim

DATA DIRECTORY (DEFAULT) ~
                  *$XDG_DATA_HOME*              Nvim: stdpath("data")
    Unix:         ~/.local/share              ~/.local/share/nvim
    Windows:      ~/AppData/Local             ~/AppData/Local/nvim-data

RUN DIRECTORY (DEFAULT) ~
                  *$XDG_RUNTIME_DIR*            Nvim: stdpath("run")
    Unix:         /tmp/nvim.user/xxx          /tmp/nvim.user/xxx
    Windows:      $TMP/nvim.user/xxx          $TMP/nvim.user/xxx

STATE DIRECTORY (DEFAULT) ~
                  *$XDG_STATE_HOME*             Nvim: stdpath("state")
    Unix:         ~/.local/state              ~/.local/state/nvim
    Windows:      ~/AppData/Local             ~/AppData/Local/nvim-data

CACHE DIRECTORY (DEFAULT) ~
                  *$XDG_CACHE_HOME*             Nvim: stdpath("cache")
    Unix:         ~/.cache                    ~/.cache/nvim
    Windows:      ~/AppData/Local/Temp        ~/AppData/Local/Temp/nvim-data

LOG FILE (DEFAULT) ~
                  `$NVIM_LOG_FILE`              Nvim: stdpath("log")/log
    Unix:         ~/.local/state/nvim         ~/.local/state/nvim/log
    Windows:      ~/AppData/Local/nvim-data   ~/AppData/Local/nvim-data/log

Note that stdpath("log") is currently an alias for stdpath("state").

ADDITIONAL CONFIGS DIRECTORY (DEFAULT) ~
                  *$XDG_CONFIG_DIRS*            Nvim: stdpath("config_dirs")
    Unix:         /etc/xdg/                   /etc/xdg/nvim
    Windows:      Not applicable              Not applicable

ADDITIONAL DATA DIRECTORY (DEFAULT) ~
                  *$XDG_DATA_DIRS*              Nvim: stdpath("data_dirs")
    Unix:         /usr/local/share            /usr/local/share/nvim
                  /usr/share                  /usr/share/nvim
    Windows:      Not applicable              Not applicable

NVIM_APPNAME					*$NVIM_APPNAME*
The standard directories can be further configured by the `$NVIM_APPNAME`
environment variable. This variable controls the sub-directory that Nvim will
read from (and auto-create) in each of the base directories. For example,
setting `$NVIM_APPNAME` to "foo" before starting will cause Nvim to look for
configuration files in `$XDG_CONFIG_HOME/foo` instead of
`$XDG_CONFIG_HOME/nvim`. `$NVIM_APPNAME` must be a name, such as "foo", or a
relative path, such as "foo/bar".

Note: In the help wherever `$XDG_CONFIG_…/nvim` is mentioned it is understood
as `$XDG_CONFIG_…/$NVIM_APPNAME`.

						*state-isolation*
One use-case for $NVIM_APPNAME is to "isolate" Nvim applications.
Alternatively, for true isolation, on Linux you can use cgroups namespaces: >
    systemd-run --user -qt -p PrivateUsers=yes -p BindPaths=/home/user/profile_xy:/home/user/.config/nvim nvim
<
						*stateless*
To run Nvim without creating any directories or data files: >
    NVIM_LOG_FILE=/dev/null nvim -n -i NONE

LOG FILE					*log* *$NVIM_LOG_FILE* *E5430*
Besides 'debug' and 'verbose', Nvim keeps a general log file for internal
debugging, plugins and RPC clients. >
	:echo $NVIM_LOG_FILE
By default, the file is located at stdpath("log")/log ($XDG_STATE_HOME/nvim/log)
unless that path is inaccessible or if $NVIM_LOG_FILE was set before |startup|.


 vim:noet:tw=78:ts=8:ft=help:norl:

Title: Standard Paths and Environment Variables
Summary
This section provides a detailed breakdown of Nvim's standard directories for configuration, data, run, state, cache, and logs on both Unix and Windows systems. It explains how these directories are determined by the XDG environment variables and provides default paths. The section also covers how the `$NVIM_APPNAME` environment variable can be used to further configure these directories and isolate Nvim applications. Lastly, it discusses how to run Nvim without creating any directories or data files and details the use of the log file for debugging.