From d34c64e342dfba9248d1055e702d02620a1b31a8 Mon Sep 17 00:00:00 2001 From: Ghjuvan Lacambre Date: Thu, 16 Feb 2023 13:15:02 +0100 Subject: feat: $NVIM_APPNAME #22128 This commit implements the ability to control all of the XDG paths Neovim should use. This is done by setting an environment variable named NVIM_APPNAME. For example, setting $NVIM_APPNAME makes Neovim look for its configuration directory in $XDG_CONFIG_HOME/$NVIM_APPNAME instead of $XDG_CONFIG_HOME/nvim. If NVIM_APPNAME is not set or is an empty string, "nvim" will be used as default. The usecase for this feature is to enable an easy way to switch from configuration to configuration. One might argue that the various $XDG environment variables can already be used for this usecase. However, setting $XDG environment variables also affects tools spawned by Neovim. For example, while setting $XDG_CONFIG_HOME will enable Neovim to use a different configuration directory, it will also prevent Git from finding its "default" configuration. Closes https://github.com/neovim/neovim/issues/21691 --- runtime/doc/news.txt | 4 ++++ runtime/doc/starting.txt | 12 ++++++++++++ 2 files changed, 16 insertions(+) (limited to 'runtime') diff --git a/runtime/doc/news.txt b/runtime/doc/news.txt index 2afb22bb43..ae21bc47ca 100644 --- a/runtime/doc/news.txt +++ b/runtime/doc/news.txt @@ -55,6 +55,10 @@ NEW FEATURES *news-features* The following new APIs or features were added. +• A new environment variable named NVIM_APPNAME enables configuring the + directories where Neovim should find its configuration and state files. See + `:help $NVIM_APPNAME` . + • |nvim_open_win()| now accepts a relative `mouse` option to open a floating win relative to the mouse. Note that the mouse doesn't update frequently without setting `vim.o.mousemoveevent = true` diff --git a/runtime/doc/starting.txt b/runtime/doc/starting.txt index 5e0718c3bb..67a88913fb 100644 --- a/runtime/doc/starting.txt +++ b/runtime/doc/starting.txt @@ -1385,6 +1385,18 @@ STATE DIRECTORY (DEFAULT) ~ Note: Throughout the user manual these defaults are used as placeholders, e.g. "~/.config" is understood to mean "$XDG_CONFIG_HOME or ~/.config". +NVIM_APPNAME *$NVIM_APPNAME* +The XDG directories used by Nvim can be further configured by setting the +`$NVIM_APPNAME` environment variable. This variable controls the directory +Neovim will look for (and auto-create) in the various XDG parent directories. +For example, setting `$NVIM_APPNAME` to "neovim" before running Neovim will +result in Neovim looking for configuration files in `$XDG_CONFIG_HOME/neovim` +instead of `$XDG_CONFIG_HOME/nvim`. + +Note: Similarly to the $XDG environment variables, when +`$XDG_CONFIG_HOME/nvim` is mentionned, it should be understood as +`$XDG_CONFIG_HOME/$NVIM_APPNAME`. + LOG FILE *$NVIM_LOG_FILE* *E5430* Besides 'debug' and 'verbose', Nvim keeps a general log file for internal debugging, plugins and RPC clients. > -- cgit