How to run nvim in an “isolated” environment?


I was recently writing a “minimal” init.lua for a friend to try out Neovim nightly with LSP, and I’m curious as to the best way to test it.

I know you can run something like nvim -u path/to/config . to use a specific config file, but I’m wanting to make sure that things like the packer.nvim bootstrapping itself and using different plugins without having to blow away my own environment.


1 Like

The minimal init.lua I provide in nvim-lspconfig both bootstraps itself and installs itself in /tmp


What is the difference between the nvim_command on line 10 and the vim.cmds on lines 12-14? Also isn’t line 10 the same as line 12?

Never promised it was a non-rendundant/perfect config :slight_smile: Edit: now it is

vim.cmd = vim.api.nvim_command

1 Like

Since Neovim reads XDG base directory environment variables, I have wrapper shell script that I keep in its own folder for when I want an isolated environment
#!/usr/bin/env sh

export VIMRUNTIME="$NVIM_SRC_DIR/runtime"
export HOME="$PWD"
export XDG_CONFIG_HOME="$HOME/.config"
export XDG_DATA_HOME="$HOME/.local/share"
export XDG_CACHE_HOME="$HOME/.cache"

exec "$NVIM_BIN" "$@"

It’s probably not 100% isolated but it’s served me well for simple testing/troubleshooting

Now it’s even more minimal :grinning:

I think this is what I was looking for! I’ll try something like this out and see if it works for me. Thanks!