Skip to content

Commit

Permalink
docs/lazy-loading: add extra examples
Browse files Browse the repository at this point in the history
  • Loading branch information
khaneliman committed Jan 27, 2025
1 parent a879adb commit af4483c
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions docs/user-guide/lazy-loading.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ a trigger condition is met.
You need to define the trigger conditions in which a plugin will be loaded. This
is done through the `lazyLoad.settings` option.

Load on command:

```nix
plugins = {
grug-far = {
Expand All @@ -55,6 +57,8 @@ plugins = {
};
```

Load on file type:

```nix
plugins = {
glow = {
Expand All @@ -63,6 +67,8 @@ plugins = {
};
```

Different load conditions:

```nix
plugins.toggleterm = {
enable = true;
Expand All @@ -78,6 +84,35 @@ plugins.toggleterm = {
};
```

Load on keymap with dependency:

```nix
plugins.dap-ui = {
enable = true;
lazyLoad.settings = {
# We need to access nvim-dap in the after function.
before.__raw = ''
function()
require('lz.n').trigger_load('nvim-dap')
end
'';
keys = [
{
__unkeyed-1 = "<leader>du";
__unkeyed-2.__raw = ''
function()
require('dap.ext.vscode').load_launchjs(nil, {})
require("dapui").toggle()
end
'';
desc = "Toggle Debugger UI";
}
];
};
};
```

### Colorschemes

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

0 comments on commit af4483c

Please sign in to comment.