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

@ -21,6 +21,17 @@ in {
vim = {
startPlugins = ["nvim-treesitter"] ++ optional usingNvimCmp "cmp-treesitter";
lazy.plugins = {
cmp-treesitter = mkIf usingNvimCmp {
package = "cmp-treesitter";
after = ''
local path = vim.fn.globpath(vim.o.packpath, 'pack/*/opt/cmp-treesitter')
require("rtp_nvim").source_after_plugin_dir(path)
'';
};
nvim-cmp.after = mkIf cfg.cmp.enable "require('lz.n').trigger_load('cmp-treesitter')";
};
autocomplete.nvim-cmp.sources = {treesitter = "[Treesitter]";};
treesitter.grammars = optionals cfg.addDefaultGrammars cfg.defaultGrammars;