nix-community / kickstart-nix.nvim

❄️ A dead simple Nix flake template repository for Neovim derivations [maintainer=@mrcjkb]
GNU General Public License v2.0
231 stars 10 forks source link

How to lazy load? #6

Closed haru02w closed 10 months ago

haru02w commented 10 months ago

I ported my lazy.nvim config to this template and I'm having performance issues. Is there any way to lazy load plugins using this template or should I add lazy-nix-helper.nvim as a plugin and go from there?

mrcjkb commented 10 months ago

Hey 👋

I'm afraid I don't have any experience with lazy-nix-helper.

Neovim has built-in support for lazy loading plugins with the :packadd[!] command.

You can track down which plugins are causing startup performance issues (nvim --startuptime {fname}) and set them to optional in the plugins list in nix/neovim-overlay.nix.

For example, telescope-nvim would become

{
  plugin = telescope-nvim;
  optional = true;
}

Then it won't be loaded until you call :packadd! telescope.nvim (or from lua, vim.cmd { 'packadd!', 'telescope.nvim' }).

If you want something more like the way lazy.nvim does it, I guess lazy-nix-helper is the way to go.

haru02w commented 10 months ago

Exactly what I was looking for. Thanks!