cmp: actually lazy load source

This commit is contained in:
Ching Pei Yang 2024-10-22 15:14:15 +02:00
commit 4b703964e1
No known key found for this signature in database
GPG key ID: 062FBBCE1D0C5DD9
4 changed files with 43 additions and 0 deletions

View file

@ -5,6 +5,7 @@
}: let
inherit (builtins) toJSON;
inherit (lib.modules) mkIf;
inherit (lib.strings) optionalString;
cfg = config.vim.assistant.copilot;
@ -59,7 +60,14 @@ in {
copilot-cmp = mkIf cfg.cmp.enable {
package = "copilot-cmp";
lazy = true;
after = optionalString config.vim.lazy.enable ''
local path = vim.fn.globpath(vim.o.packpath, 'pack/*/opt/copilot-cmp')
require("rtp_nvim").source_after_plugin_dir(path)
require("lz.n").trigger_load("copilot-lua")
'';
};
nvim-cmp.after = mkIf cfg.cmp.enable "require('lz.n').trigger_load('copilot-cmp')";
};
autocomplete.nvim-cmp.sources = {copilot = "[Copilot]";};