mirror of
https://github.com/NotAShelf/nvf.git
synced 2026-01-16 15:30:50 +00:00
Compare commits
8 commits
60c3a2ff1e
...
14fb42562e
| Author | SHA1 | Date | |
|---|---|---|---|
|
14fb42562e |
|||
|
e0715c4e78 |
|||
|
|
7696f470a7 |
||
|
|
d105f69921 | ||
|
|
5f99c7f4e5 | ||
|
|
c639cf5064 | ||
|
|
e2d10e8fb2 | ||
|
|
58021beb1c |
8 changed files with 72 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
|
[blink.cmp]: https://github.com/saghen/blink.cmp
|
||||||
|
|
||||||
- Add [blink.cmp] support.
|
- Add [blink.cmp] support.
|
||||||
|
- Add `LazyFile` user event.
|
||||||
|
|
||||||
[diniamo](https://github.com/diniamo):
|
[diniamo](https://github.com/diniamo):
|
||||||
|
|
||||||
|
|
@ -244,8 +245,8 @@
|
||||||
syncing of nvim shell environment with direnv's.
|
syncing of nvim shell environment with direnv's.
|
||||||
- Add [blink.cmp] source options and some default-disabled sources.
|
- Add [blink.cmp] source options and some default-disabled sources.
|
||||||
- Add [blink.cmp] option to add
|
- Add [blink.cmp] option to add
|
||||||
[friendly-snippets](https://github.com/rafamadriz/friendly-snippets)
|
[friendly-snippets](https://github.com/rafamadriz/friendly-snippets) so
|
||||||
so blink.cmp can source snippets from it.
|
blink.cmp can source snippets from it.
|
||||||
- Fix [blink.cmp] breaking when built-in sources were modified.
|
- Fix [blink.cmp] breaking when built-in sources were modified.
|
||||||
|
|
||||||
[TheColorman](https://github.com/TheColorman):
|
[TheColorman](https://github.com/TheColorman):
|
||||||
|
|
@ -271,3 +272,7 @@
|
||||||
[Butzist](https://github.com/butzist):
|
[Butzist](https://github.com/butzist):
|
||||||
|
|
||||||
- Add Helm chart support under `vim.languages.helm`.
|
- Add Helm chart support under `vim.languages.helm`.
|
||||||
|
|
||||||
|
[rice-cracker-dev](https://github.com/rice-cracker-dev):
|
||||||
|
|
||||||
|
- `eslint_d` now checks for configuration files to load.
|
||||||
|
|
|
||||||
|
|
@ -37,6 +37,12 @@ in {
|
||||||
inherit (cfg) setupOpts;
|
inherit (cfg) setupOpts;
|
||||||
after = mkIf cfg.cmp.enable "require('copilot_cmp').setup()";
|
after = mkIf cfg.cmp.enable "require('copilot_cmp').setup()";
|
||||||
|
|
||||||
|
event = [
|
||||||
|
{
|
||||||
|
event = "User";
|
||||||
|
pattern = "LazyFile";
|
||||||
|
}
|
||||||
|
];
|
||||||
cmd = ["Copilot" "CopilotAuth" "CopilotDetach" "CopilotPanel" "CopilotStop"];
|
cmd = ["Copilot" "CopilotAuth" "CopilotDetach" "CopilotPanel" "CopilotStop"];
|
||||||
keys = [
|
keys = [
|
||||||
(mkLuaKeymap ["n"] cfg.mappings.panel.accept (wrapPanelBinding ''require("copilot.panel").accept'' cfg.mappings.panel.accept) "[copilot] Accept suggestion" {})
|
(mkLuaKeymap ["n"] cfg.mappings.panel.accept (wrapPanelBinding ''require("copilot.panel").accept'' cfg.mappings.panel.accept) "[copilot] Accept suggestion" {})
|
||||||
|
|
|
||||||
|
|
@ -72,6 +72,16 @@
|
||||||
ls_sources,
|
ls_sources,
|
||||||
null_ls.builtins.diagnostics.eslint_d.with({
|
null_ls.builtins.diagnostics.eslint_d.with({
|
||||||
command = "${getExe pkg}",
|
command = "${getExe pkg}",
|
||||||
|
condition = function(utils)
|
||||||
|
return utils.root_has_file({
|
||||||
|
"eslint.config.js",
|
||||||
|
"eslint.config.mjs",
|
||||||
|
".eslintrc",
|
||||||
|
".eslintrc.json",
|
||||||
|
".eslintrc.js",
|
||||||
|
".eslintrc.yml",
|
||||||
|
})
|
||||||
|
end,
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
'';
|
'';
|
||||||
|
|
|
||||||
|
|
@ -72,6 +72,16 @@
|
||||||
ls_sources,
|
ls_sources,
|
||||||
null_ls.builtins.diagnostics.eslint_d.with({
|
null_ls.builtins.diagnostics.eslint_d.with({
|
||||||
command = "${getExe pkg}",
|
command = "${getExe pkg}",
|
||||||
|
condition = function(utils)
|
||||||
|
return utils.root_has_file({
|
||||||
|
"eslint.config.js",
|
||||||
|
"eslint.config.mjs",
|
||||||
|
".eslintrc",
|
||||||
|
".eslintrc.json",
|
||||||
|
".eslintrc.js",
|
||||||
|
".eslintrc.yml",
|
||||||
|
})
|
||||||
|
end,
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
'';
|
'';
|
||||||
|
|
|
||||||
|
|
@ -123,6 +123,16 @@
|
||||||
ls_sources,
|
ls_sources,
|
||||||
null_ls.builtins.diagnostics.eslint_d.with({
|
null_ls.builtins.diagnostics.eslint_d.with({
|
||||||
command = "${getExe pkg}",
|
command = "${getExe pkg}",
|
||||||
|
condition = function(utils)
|
||||||
|
return utils.root_has_file({
|
||||||
|
"eslint.config.js",
|
||||||
|
"eslint.config.mjs",
|
||||||
|
".eslintrc",
|
||||||
|
".eslintrc.json",
|
||||||
|
".eslintrc.js",
|
||||||
|
".eslintrc.yml",
|
||||||
|
})
|
||||||
|
end,
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
'';
|
'';
|
||||||
|
|
|
||||||
|
|
@ -134,6 +134,15 @@ in {
|
||||||
startPlugins = ["lz-n" "lzn-auto-require"];
|
startPlugins = ["lz-n" "lzn-auto-require"];
|
||||||
|
|
||||||
optPlugins = pluginPackages;
|
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 = ''
|
lazy.builtLazyConfig = ''
|
||||||
require('lz.n').load(${toLuaObject lznSpecs})
|
require('lz.n').load(${toLuaObject lznSpecs})
|
||||||
|
|
|
||||||
|
|
@ -126,7 +126,7 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
event = mkOption {
|
event = mkOption {
|
||||||
type = nullOr (oneOf [str (listOf str) lznEvent]);
|
type = nullOr (oneOf [str lznEvent (listOf (either str lznEvent))]);
|
||||||
default = null;
|
default = null;
|
||||||
description = "Lazy-load on event";
|
description = "Lazy-load on event";
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue