Skip to content

Commit af4483c

Browse files
committed
docs/lazy-loading: add extra examples
1 parent a879adb commit af4483c

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

docs/user-guide/lazy-loading.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ a trigger condition is met.
4242
You need to define the trigger conditions in which a plugin will be loaded. This
4343
is done through the `lazyLoad.settings` option.
4444

45+
Load on command:
46+
4547
```nix
4648
plugins = {
4749
grug-far = {
@@ -55,6 +57,8 @@ plugins = {
5557
};
5658
```
5759

60+
Load on file type:
61+
5862
```nix
5963
plugins = {
6064
glow = {
@@ -63,6 +67,8 @@ plugins = {
6367
};
6468
```
6569

70+
Different load conditions:
71+
6672
```nix
6773
plugins.toggleterm = {
6874
enable = true;
@@ -78,6 +84,35 @@ plugins.toggleterm = {
7884
};
7985
```
8086

87+
Load on keymap with dependency:
88+
89+
```nix
90+
plugins.dap-ui = {
91+
enable = true;
92+
93+
lazyLoad.settings = {
94+
# We need to access nvim-dap in the after function.
95+
before.__raw = ''
96+
function()
97+
require('lz.n').trigger_load('nvim-dap')
98+
end
99+
'';
100+
keys = [
101+
{
102+
__unkeyed-1 = "<leader>du";
103+
__unkeyed-2.__raw = ''
104+
function()
105+
require('dap.ext.vscode').load_launchjs(nil, {})
106+
require("dapui").toggle()
107+
end
108+
'';
109+
desc = "Toggle Debugger UI";
110+
}
111+
];
112+
};
113+
};
114+
```
115+
81116
### Colorschemes
82117

83118
Colorschemes do not require explicit settings configuration. In `lz-n`, we will

0 commit comments

Comments
 (0)