Skip to content

Commit

Permalink
🔧 (blink): add compat
Browse files Browse the repository at this point in the history
  • Loading branch information
elythh committed Dec 23, 2024
1 parent e87f09e commit a41b29f
Show file tree
Hide file tree
Showing 6 changed files with 215 additions and 59 deletions.
1 change: 1 addition & 0 deletions config/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

./plug/completion/avante.nix
./plug/completion/blink.nix
./plug/completion/blink-compat.nix
./plug/completion/cmp.nix
./plug/completion/copilot-cmp.nix
./plug/completion/schemastore.nix
Expand Down
9 changes: 9 additions & 0 deletions config/plug/completion/blink-compat.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
plugins.blink-compat = {
enable = true;
settings = {
debug = false;
impersonate_nvim_cmp = true;
};
};
}
118 changes: 76 additions & 42 deletions config/plug/completion/blink.nix
Original file line number Diff line number Diff line change
@@ -1,32 +1,30 @@
{ pkgs, ... }:
{
pkgs,
inputs,
system,
...
}:
{
extraPlugins = with pkgs.vimPlugins; [
blink-cmp-copilot
];

plugins = {
cmp-emoji.enable = true;
cmp-git.enable = true;
cmp-spell.enable = true;
blink-cmp = {
enable = true;
package = inputs.blink-cmp.packages.${system}.default;
luaConfig.pre = # lua
''
require('blink.compat').setup({debug = true, impersonate_nvim_cmp = true})
'';

settings = {
accept = {
auto_brackets = {
enabled = true;
};
};
windows.documentation = {
auto_show = true;
};
highlight = {
use_nvim_cmp_as_default = true;
};
keymap = {
preset = "super-tab";
};
trigger = {
signature_help = {
enabled = true;
};
};
signature = {
enabled = true;
};
Expand All @@ -37,15 +35,32 @@
"path"
"luasnip"
"buffer"
"treesitter"
# "treesitter"
"copilot"
"emoji"
"spell"
"git"
];
"lsp" = { };
"treesitter" = { };
"path" = { };
"snippets" = { };
"buffer" = { };
"copilot" = { };
providers = {
emoji = {
name = "emoji";
module = "blink.compat.source";
};
copilot = {
name = "copilot";
module = "blink-cmp-copilot";
};
git = {
name = "git";
module = "blink.compat.source";
score_offset = 0;
};
spell = {
name = "spell";
module = "blink.compat.source";
score_offset = 0;
};
};
};

completion = {
Expand All @@ -55,24 +70,43 @@
documentation = {
auto_show = true;
};
};

opts = {
snippets = {
expand.__raw = ''
function(snippet) require('luasnip').lsp_expand(snippet) end
'';
active.__raw = ''
function(filter)
if filter and filter.direction then
return require('luasnip').jumpable(filter.direction)
end
return require('luasnip').in_snippet()
end
'';
jump.__raw = ''
function(direction) require('luasnip').jump(direction) end
'';
accept = {
auto_brackets = {
enabled = true;
};
};
menu = {
draw = {
gap = 2;
treesitter = [
"lsp"
"copilot"
];
columns = [
{
__unkeyed-1 = "label";
__unkeyed-2 = "label_description";
gap = 1;
}
{
__unkeyed-1 = "kind_icon";
__unkeyed-2 = "kind";
gap = 1;
}
];
components = {
label = {
width = {
fill = true;
};
};
"kind_icon" = {
width = {
fill = true;
};
};
};
};
};
};
};
Expand Down
2 changes: 1 addition & 1 deletion config/plug/completion/copilot-cmp.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
plugins.copilot-cmp = lib.mkIf config.plugins.cmp.enable {
enable = true;
};
plugins.copilot-lua = lib.mkIf config.plugins.cmp.enable {
plugins.copilot-lua = {
enable = true;
suggestion = {
enabled = false;
Expand Down
Loading

0 comments on commit a41b29f

Please sign in to comment.