Switch configs in neovim


Neovim recently got a feature for selecting different neovim configs based on an environment variable. The variable is NVIM_APPNAME and it is set to “nvim" as default. It is used in the path when looking up configuration like this ~/.config/{NVIM_APPNAME}. Thus, if it is set to lazyvim the config will be loaded from ~/.config/lazyvim.

To use it with vim, prefix the nvim command with the environment variable.

NVIM_APPNAME=lazyvim nvim

This is super useful when testing out different premade configs, but it can also be useful when making changes to the config without disrupting the daily workflow by having two clones of your own config into ~/.config/nvim and ~/.config/nvim-test