mirror of
https://github.com/NotAShelf/nvf.git
synced 2025-03-30 18:01:52 +00:00
Merge pull request #734 from horriblename/lazy-file
Some checks are pending
Set up binary cache / cachix (default) (push) Waiting to run
Set up binary cache / cachix (maximal) (push) Waiting to run
Set up binary cache / cachix (nix) (push) Waiting to run
Validate flake & check documentation / Validate Flake Documentation (push) Waiting to run
Validate flake & check documentation / Validate hyperlinks in documentation sources (push) Waiting to run
Validate flake & check formatting / Validate Flake (push) Waiting to run
Validate flake & check formatting / Formatting via Alejandra (push) Waiting to run
Build and deploy documentation / Check latest commit (push) Waiting to run
Build and deploy documentation / publish (push) Blocked by required conditions
Check for typos in the source tree / check-typos (push) Waiting to run
Some checks are pending
Set up binary cache / cachix (default) (push) Waiting to run
Set up binary cache / cachix (maximal) (push) Waiting to run
Set up binary cache / cachix (nix) (push) Waiting to run
Validate flake & check documentation / Validate Flake Documentation (push) Waiting to run
Validate flake & check documentation / Validate hyperlinks in documentation sources (push) Waiting to run
Validate flake & check formatting / Validate Flake (push) Waiting to run
Validate flake & check formatting / Formatting via Alejandra (push) Waiting to run
Build and deploy documentation / Check latest commit (push) Waiting to run
Build and deploy documentation / publish (push) Blocked by required conditions
Check for typos in the source tree / check-typos (push) Waiting to run
lazy: create LazyFile user event, load copilot-lua on LazyFile
This commit is contained in:
commit
14fb42562e
5 changed files with 38 additions and 3 deletions
|
@ -38,3 +38,22 @@ As of version **0.7**, we exposed an API for configuring lazy-loaded plugins via
|
|||
};
|
||||
}
|
||||
```
|
||||
|
||||
## LazyFile event {#sec-lazyfile-event}
|
||||
|
||||
You can use the `LazyFile` user event to load a plugin when a file is opened:
|
||||
|
||||
```nix
|
||||
{
|
||||
config.vim.lazy.plugins = {
|
||||
"aerial.nvim" = {
|
||||
package = pkgs.vimPlugins.aerial-nvim;
|
||||
event = [{event = "User"; pattern = "LazyFile";}];
|
||||
# ...
|
||||
};
|
||||
};
|
||||
}
|
||||
```
|
||||
|
||||
You can consider `LazyFile` as an alias to
|
||||
`["BufReadPost" "BufNewFile" "BufWritePre"]`
|
||||
|
|
|
@ -89,6 +89,7 @@
|
|||
[blink.cmp]: https://github.com/saghen/blink.cmp
|
||||
|
||||
- Add [blink.cmp] support.
|
||||
- Add `LazyFile` user event.
|
||||
|
||||
[diniamo](https://github.com/diniamo):
|
||||
|
||||
|
@ -244,8 +245,8 @@
|
|||
syncing of nvim shell environment with direnv's.
|
||||
- Add [blink.cmp] source options and some default-disabled sources.
|
||||
- Add [blink.cmp] option to add
|
||||
[friendly-snippets](https://github.com/rafamadriz/friendly-snippets)
|
||||
so blink.cmp can source snippets from it.
|
||||
[friendly-snippets](https://github.com/rafamadriz/friendly-snippets) so
|
||||
blink.cmp can source snippets from it.
|
||||
- Fix [blink.cmp] breaking when built-in sources were modified.
|
||||
|
||||
[TheColorman](https://github.com/TheColorman):
|
||||
|
|
|
@ -37,6 +37,12 @@ in {
|
|||
inherit (cfg) setupOpts;
|
||||
after = mkIf cfg.cmp.enable "require('copilot_cmp').setup()";
|
||||
|
||||
event = [
|
||||
{
|
||||
event = "User";
|
||||
pattern = "LazyFile";
|
||||
}
|
||||
];
|
||||
cmd = ["Copilot" "CopilotAuth" "CopilotDetach" "CopilotPanel" "CopilotStop"];
|
||||
keys = [
|
||||
(mkLuaKeymap ["n"] cfg.mappings.panel.accept (wrapPanelBinding ''require("copilot.panel").accept'' cfg.mappings.panel.accept) "[copilot] Accept suggestion" {})
|
||||
|
|
|
@ -134,6 +134,15 @@ in {
|
|||
startPlugins = ["lz-n" "lzn-auto-require"];
|
||||
|
||||
optPlugins = pluginPackages;
|
||||
augroups = [{name = "nvf_lazy_file_hooks";}];
|
||||
autocmds = [
|
||||
{
|
||||
event = ["BufReadPost" "BufNewFile" "BufWritePre"];
|
||||
group = "nvf_lazy_file_hooks";
|
||||
command = "doautocmd User LazyFile";
|
||||
once = true;
|
||||
}
|
||||
];
|
||||
|
||||
lazy.builtLazyConfig = ''
|
||||
require('lz.n').load(${toLuaObject lznSpecs})
|
||||
|
|
|
@ -126,7 +126,7 @@
|
|||
};
|
||||
|
||||
event = mkOption {
|
||||
type = nullOr (oneOf [str (listOf str) lznEvent]);
|
||||
type = nullOr (oneOf [str lznEvent (listOf (either str lznEvent))]);
|
||||
default = null;
|
||||
description = "Lazy-load on event";
|
||||
};
|
||||
|
|
Loading…
Add table
Reference in a new issue