2024-10-09 17:50:34 +00:00
|
|
|
{
|
|
|
|
config,
|
|
|
|
lib,
|
|
|
|
...
|
|
|
|
}: let
|
|
|
|
inherit (lib.modules) mkIf;
|
2024-10-22 13:14:15 +00:00
|
|
|
inherit (lib.strings) optionalString;
|
2024-10-09 17:50:34 +00:00
|
|
|
|
|
|
|
cfg = config.vim.snippets.luasnip;
|
|
|
|
in {
|
|
|
|
config = mkIf cfg.enable {
|
|
|
|
vim = {
|
2024-10-21 16:42:02 +00:00
|
|
|
lazy.plugins = {
|
|
|
|
luasnip = {
|
|
|
|
package = "luasnip";
|
|
|
|
lazy = true;
|
|
|
|
after = cfg.loaders;
|
|
|
|
};
|
|
|
|
cmp-luasnip = mkIf config.vim.autocomplete.nvim-cmp.enable {
|
|
|
|
package = "cmp-luasnip";
|
|
|
|
lazy = true;
|
2024-10-22 13:14:15 +00:00
|
|
|
after = ''
|
|
|
|
local path = vim.fn.globpath(vim.o.packpath, 'pack/*/opt/cmp-luasnip')
|
|
|
|
require("rtp_nvim").source_after_plugin_dir(path)
|
|
|
|
'';
|
2024-10-21 16:42:02 +00:00
|
|
|
};
|
2024-10-22 13:14:15 +00:00
|
|
|
nvim-cmp.after = optionalString config.vim.lazy.enable ''
|
|
|
|
require("lz.n").trigger_load("cmp-luasnip")
|
|
|
|
'';
|
2024-10-21 16:42:02 +00:00
|
|
|
};
|
|
|
|
startPlugins = cfg.providers;
|
2024-10-09 17:50:34 +00:00
|
|
|
autocomplete.nvim-cmp.sources = {luasnip = "[LuaSnip]";};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|