I was refactoring my Neovim config but I do not want to overwrite the current config yet. So I’m looking for the solution to load config from a custom directory which I found here.

  1. Create a new directory for the new Neovim config, for example, ~/neovim-config.
    └── nvim
        └── init.lua
    The config structure must be like this, init.lua file under nvim directory, similar to ~/.config/nvim/init.lua:
  2. Run neovim by set XDG_CONFIG_HOME pointing to the new config location:
    XDG_CONFIG_HOME=~/neovim-config nvim
  3. Done, now Neovim new config loaded from ~/neovim-config