mirror of
https://github.com/NotAShelf/neovim-flake.git
synced 2025-01-09 04:39:47 +01:00
blink: add luasnip integration
This commit is contained in:
parent
e280cdc8f3
commit
e2de9a1e27
1 changed files with 31 additions and 9 deletions
|
@ -4,16 +4,38 @@
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
inherit (lib.modules) mkIf;
|
inherit (lib.modules) mkIf;
|
||||||
cfg = config.vim.autocomplete.blink-nvim;
|
inherit (lib.generators) mkLuaInline;
|
||||||
|
cfg = config.vim.autocomplete.blink-cmp;
|
||||||
in {
|
in {
|
||||||
vim = mkIf cfg.enable {
|
vim = mkIf cfg.enable {
|
||||||
lazy.plugins = [
|
lazy.plugins.blink-cmp = {
|
||||||
{
|
package = "blink-cmp";
|
||||||
package = "blink-cmp";
|
setupModule = "blink.cmp";
|
||||||
setupModule = "blink";
|
inherit (cfg) setupOpts;
|
||||||
inherit (cfg) setupOpts;
|
event = ["InsertEnter" "CmdlineEnter"];
|
||||||
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";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue