neovim-flake/modules/plugins/completion/blink-cmp/config.nix

42 lines
1 KiB
Nix
Raw Normal View History

2024-12-23 01:24:06 +01:00
{
lib,
config,
...
}: let
inherit (lib.modules) mkIf;
2024-12-23 02:51:53 +01:00
inherit (lib.generators) mkLuaInline;
cfg = config.vim.autocomplete.blink-cmp;
2024-12-23 01:24:06 +01:00
in {
vim = mkIf cfg.enable {
2024-12-23 02:51:53 +01:00
lazy.plugins.blink-cmp = {
package = "blink-cmp";
setupModule = "blink.cmp";
inherit (cfg) setupOpts;
event = ["InsertEnter" "CmdlineEnter"];
};
autocomplete = {
enableSharedCmpSources = true;
blink-cmp.setupOpts = {
snippets = mkIf config.vim.snippets.luasnip.enable {
expand = mkLuaInline ''
function(snippet)
return require("luasnip").lsp_expand(snippet)
end
'';
active = mkLuaInline ''
function(filter)
if filter and filter.direction then
return require('luasnip').jumpable(filter.direction)
end
return require('luasnip').in_snippet()
end
'';
jump = mkLuaInline "function(direction) require('luasnip').jump(direction) end";
};
};
};
2024-12-23 01:24:06 +01:00
};
}