Robert Schaap

Blogging like it’s 1999

Multiple NeoVim configurations

Recently I’ve been using Neovim to write some Rust code. The fastest way to get up and running seemed to be NvChad. After using that for a while I decided I wanted to try out some other configurations such as kickstart.nvim and LazyVim. At the same time I didn’t want to throw away my old config and it would be even better if I could switch easily between different configs.

Fortunately, this is very easy to accomplish. The first step is to take your existing config and rename it. Since I started with NvChad I will do the following.

❯ mv .config/nvim .config/nvim-nvchad

Then you can start nvim with this config by specifying the NVIM_APPNAME with the following command.

❯ NVIM_APPNAME=nvim-nvchad nvim

If you want to be able to start it quickly you can simply create an alias that does this. After this you will be able to start NeoVim with the NvChad configuration with the nvchad command.

❯ alias nvchad="NVIM_APPNAME=nvim-nvchad nvim"

Then to add another configuration you just create a seperate configuration folder. For instance to create a kickstart configuration you clone the repo into .config/nvim-kickstart, create an alias to start it.

❯ git clone https://github.com/nvim-lua/kickstart.nvim.git .config/nvim-kickstart
Cloning into '.config/nvim-kickstart'...
remote: Enumerating objects: 675, done.
remote: Counting objects: 100% (3/3), done.
remote: Compressing objects: 100% (3/3), done.
remote: Total 675 (delta 0), reused 0 (delta 0), pack-reused 672
Receiving objects: 100% (675/675), 270.87 KiB | 2.08 MiB/s, done.
Resolving deltas: 100% (331/331), done.
❯ alias nvkickstart="NVIM_APPNAME=nvim-kickstart nvim"
❯ alias vim=nvkickstart

You can also alias vim to nvkickstart to make it the default vim. In the end your configuration will look something like this.

❯ tree -d .config/nvim*
.config/nvim-kickstart
├── doc
└── lua
    ├── custom
    │   └── plugins
    └── kickstart
        └── plugins
.config/nvim-lazyvim
└── lua
    ├── config
    └── plugins
.config/nvim-nvchad
└── lua
    ├── core
    ├── custom
    └── plugins
        └── configs

5 directories

❯ alias | grep vim
nvchad='NVIM_APPNAME=nvim-nvchad nvim'
nvkickstart='NVIM_APPNAME=nvim-kickstart nvim'
nvlazy='NVIM_APPNAME=nvim-lazyvim nvim'
vim=nvkickstart

Happy Vimming!