@@ -31,11 +31,20 @@ provider's loading mechanism.
3131If you are just wanting to store potential configuration without enabling it,
3232you can explicitly disable it setting ` lazyLoad.enable = false ` .
3333
34- By default, we route the generated setup code to your lazy loading provider, but
35- it can be overridden by using the ` lazyLoad.settings ` option.
34+ By default, we route the generated setup code (what Nixvim would normally put in
35+ ` luaConfig.content ` ) to your lazy loading provider. For the ` lz.n ` backend, this
36+ means we automatically generate an ` after ` function for you, that will be called
37+ when a trigger condition is met.
3638
37- For ` Lz.n ` , the ` lazyLoad.settings.after ` option contains what it will call when
38- a trigger condition is met.
39+ You can override this default by providing ` lazyLoad.settings.after ` yourself.
40+ Note that this is an ** override** : once you set ` lazyLoad.settings.after ` , Nixvim
41+ will use your function instead of the auto-generated one, it will not "extend"
42+ or "wrap" the default behavior.
43+
44+ If you only need to run some extra Lua ** after** the plugin (or colorscheme) has
45+ been configured, you usually do ** not** need to override ` lazyLoad.settings.after ` .
46+ Instead, you can use the module's ` luaConfig.post ` hook, see the plugin's /
47+ colorscheme's documentation for details
3948
4049## Configuring Triggers
4150
@@ -126,3 +135,28 @@ colorschemes.catppuccin = {
126135 lazyLoad.enable = true;
127136};
128137```
138+
139+ To configure special integrations after ` catppuccin ` has been set up (while
140+ still letting Nixvim manage lazy loading and the default ` after ` ):
141+
142+ ``` nix
143+ colorscheme = "catppuccin";
144+ colorschemes.catppuccin = {
145+ enable = true;
146+ lazyLoad.enable = true;
147+
148+ # This code runs after catppuccin's setup has completed,
149+ # regardless of whether it was lazy-loaded or not.
150+ luaConfig.post = ''
151+ -- At this point catppuccin is configured, so we can safely
152+ -- derive bufferline highlights or similar settings from it.
153+ require('lz.n').trigger_load("bufferline.nvim")
154+ '';
155+ };
156+
157+ plugins.bufferline = {
158+ enable = true;
159+ settings.highlights.__raw = "require('catppuccin.special.bufferline').get_theme()";
160+ lazyLoad.settings.lazy = true; # Lazy load manually
161+ };
162+ ```
0 commit comments