How could I debug nvim config easily?
qlibp opened this issue ยท 6 comments
if I modify the github repo's lua configuration locally, the behavior won't change, and it's sure a good thing. But is there a way to quickly write & evaluate the nvim configuration by just modifying the config directly?
Should I re-build flake every time when I change sth to see what happens?
Hey ๐
My workflow is usually
- Perform modifications
nix run /path/to/flake#nvim
to test the modifications
Although it is a slightly slower feedback loop, I find it beneficial, because if something breaks severely, I can still use my unmodified config to fix things.
If you're working on something where you need a faster feedback loop, you can copy the module you're working on to your $XDG_CONFIG_HOME/$NVIM_APPNAME/...
directory and work on it there. Then copy it back when you're done.
Make sure to filter out the module you've copied over from the derivation, so that it doesn't conflict.
working on to your
$XDG_CONFIG_HOME/$NVIM_APPNAME/...
directory and work on it there
I try this one just now, but nvim seems to not load my script.
I place a init.lua
in ~/.config/nvim
, and nvim don't load this script at all. Check with :scriptnames
I place a
init.lua
in~/.config/nvim
, and nvim don't load this script at all. Check with:scriptnames
It won't source an init.lua
, because the neovim derivation has a wrapper which calls nvim -u /path/to/generated-init.lua
.
You can run nvim -u /path/to/init.lua
, but then it'll ignore the generated init.lua.
An alternative might be to put your script in ~/.config/nvim/plugin
. But in this case, it'll be sourced after the generated init.lua.
This practice should be documented in README for those like me who's not so farmiliar with nix
One more question, if I newly add a nvim config file, maybe nvim/plugin/lspconfig.lua
, and then run nix run .#nvim
, will this file get loaded?
Concretely, when I try to introduce pylsp into the configuration, the above procedure don't work. I then add the line
require('lspconfig').pylsp.setup {}
into init.lua
, then all works fine. Therefore, I suspect that the newly added files is not loaded.
Correct me if I'm wrong.
With nix flakes, only files that have been staged (git add
) or committed will be added to the derivation.