nixvim-config/plugins/blink-cmp.nix

167 lines
4.1 KiB
Nix
Raw Permalink Normal View History

{ ... }:
{
programs.nixvim = {
plugins = {
blink-cmp = {
enable = true;
settings = {
fuzzy.prebuilt_binaries = {
download = false;
ignore_version_mismatch = true;
};
keymap = {
preset = "enter";
};
signature = {
# handled by noice
enabled = false;
};
sources = {
default = [
"lsp"
"path"
"snippets"
"buffer"
"cmp_yanky"
"copilot"
"emoji"
"lazydev"
"codecompanion"
"dictionary"
];
providers = {
copilot = {
name = "Copilot";
async = true;
module = "blink-cmp-copilot";
score_offset = 50;
opts = {
max_completions = 2;
max_attemps = 3;
};
};
cmp_yanky = {
async = true;
name = "cmp_yanky";
module = "blink.compat.source";
score_offset = -5;
};
emoji = {
module = "blink-emoji";
name = "Emoji";
score_offset = -10;
opts = {
insert = true;
};
};
codecompanion = {
name = "CodeCompanion";
module = "codecompanion.providers.completion.blink";
};
dictionary = {
module = "blink-cmp-dictionary";
name = "Dict";
score_offset = -15;
min_keyword_length = 3;
opts = {
dictionary_directories = {
__unkeyed-1.__raw = ''vim.fn.expand("/etc/dictionaries/")'';
};
};
};
lazydev = {
name = "LazyDev";
module = "lazydev.integrations.blink";
score_offset = 100;
};
lsp = {
async = true;
score_offset = 60;
};
};
};
appearance = {
kind_icons = {
Copilot = "";
cmp_yanky = "";
emoji = "";
};
use_nvim_cmp_as_default = false;
};
completion = {
accept = {
auto_brackets = {
enabled = false;
};
};
list = {
selection = {
preselect.__raw = ''
function(ctx)
return ctx.mode ~= 'cmdline' and not require('blink.cmp').snippet_active({ direction = 1 })
end
'';
auto_insert = false;
};
};
documentation = {
auto_show = true;
auto_show_delay_ms = 500;
treesitter_highlighting = true;
};
menu = {
auto_show = true;
draw = {
treesitter = ["lsp"];
};
};
};
snippets = {
preset = "luasnip";
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
'';
};
};
};
blink-compat = {
enable = true;
};
};
extraConfigLua = ''
vim.api.nvim_set_hl(0, 'BlinkCmpKindDict', { default = false, fg = '#a6e3a1' })
'';
};
}