This commit is contained in:
Zacharias-Brohn
2026-01-15 23:13:52 +01:00
parent 4e79b98122
commit c42a29d509
6 changed files with 141 additions and 30 deletions
+6
View File
@@ -0,0 +1,6 @@
return {
opts = {
max_completions = 1,
max_attempts = 2,
},
}
+117 -19
View File
@@ -23,37 +23,101 @@ M.components = {
highlight = function(ctx) highlight = function(ctx)
return ctx.kind return ctx.kind
end, end,
} },
} }
local opts = { local opts = {
'saghen/blink.cmp', "saghen/blink.cmp",
dependencies = { 'rafamadriz/friendly-snippets' }, dependencies = {
"rafamadriz/friendly-snippets",
{
"fang2hou/blink-copilot",
config = function()
require "config.blink-copilot"
end,
},
},
version = "1.*",
version = '1.*',
opts = { opts = {
keymap = { keymap = {
preset = 'enter', ["<Tab>"] = {
["<Tab>"] = { "select_next", "fallback" }, function(cmp)
["<S-Tab>"] = { "select_prev", "fallback" }, if cmp.is_visible() then
return cmp.select_next()
end
if cmp.snippet_active() then
return cmp.snippet_forward()
end
return cmp.fallback()
end,
},
["<S-Tab>"] = {
function(cmp)
if cmp.is_visible() then
return cmp.select_prev()
end
if cmp.snippet_active() then
return cmp.snippet_backward()
end
return cmp.fallback()
end,
},
["<CR>"] = { "accept", "fallback" },
["Up"] = {},
["Down"] = {},
}, },
appearance = { appearance = {
nerd_font_variant = 'mono' nerd_font_variant = "mono",
},
cmdline = {
completion = {
menu = { auto_show = true },
list = { selection = { preselect = false } },
},
keymap = {
["<Tab>"] = {
function(cmp)
if cmp.is_visible() then
return cmp.select_next()
end
return cmp.fallback()
end,
},
["<S-Tab>"] = {
function(cmp)
if cmp.is_visible() then
return cmp.select_prev()
end
return cmp.fallback()
end,
},
["<CR>"] = { "accept", "fallback" },
["Up"] = {},
["Down"] = {},
},
}, },
completion = { completion = {
documentation = { auto_show = true, auto_show_delay_ms = 50 }, documentation = { auto_show = true, auto_show_delay_ms = 50 },
keyword = { range = "full" }, keyword = { range = "full" },
accept = { auto_brackets = { enabled = false }}, accept = { auto_brackets = { enabled = true } },
ghost_text = { enabled = true }, ghost_text = { enabled = true },
list = { list = {
selection = { selection = {
preselect = true, -- preselect = false,
auto_insert = false, auto_insert = false,
} },
}, },
menu = { menu = {
@@ -61,23 +125,57 @@ local opts = {
border = "single", border = "single",
draw = { draw = {
padding = 1, padding = 1,
columns = {{ "kind_icon" }, { "label" }, { "kind" }}, columns = {
{ "kind_icon" },
{ "label", "label_description", gap = 1 },
{ "kind" },
},
components = M.components, components = M.components,
} },
} },
}, },
signature = { enabled = true },
sources = { sources = {
default = { 'lsp', 'path', 'snippets', 'buffer' }, default = { "lsp", "path", "snippets", "buffer", "copilot" },
providers = {
lsp = {
score_offset = 50,
},
path = {
opts = {
get_cwd = function()
return vim.fn.getcwd()
end,
},
},
buffer = {
score_offset = -10,
},
snippets = {
score_offset = 0,
},
copilot = {
name = "copilot",
module = "blink-copilot",
score_offset = 100,
async = true,
},
},
}, },
snippets = { snippets = {
preset = 'default', preset = "default",
}, },
fuzzy = { implementation = "prefer_rust_with_warning" } fuzzy = { implementation = "prefer_rust_with_warning" },
}, },
opts_extend = { "sources.default" } opts_extend = { "sources.default" },
} }
return opts return opts
+10 -10
View File
@@ -1,21 +1,21 @@
require("copilot").setup({ require("copilot").setup {
panel = { panel = {
enabled = true, enabled = false,
auto_refresh = true, auto_refresh = true,
keymap = { keymap = {
jump_prev = "[[", jump_prev = "[[",
jump_next = "]]", jump_next = "]]",
accept = "<CR>", accept = "<CR>",
refresh = "gr", refresh = "gr",
open = "<M-CR>" open = "<M-CR>",
}, },
layout = { layout = {
position = "bottom", -- | top | left | right | horizontal | vertical position = "bottom", -- | top | left | right | horizontal | vertical
ratio = 0.4 ratio = 0.4,
}, },
}, },
suggestion = { suggestion = {
enabled = true, enabled = false,
auto_trigger = true, auto_trigger = true,
hide_during_completion = true, hide_during_completion = true,
debounce = 75, debounce = 75,
@@ -30,8 +30,8 @@ require("copilot").setup({
}, },
filetypes = { filetypes = {
-- yaml = false, -- yaml = false,
-- markdown = false, markdown = true,
-- help = false, help = true,
-- gitcommit = false, -- gitcommit = false,
-- gitrebase = false, -- gitrebase = false,
-- hgcommit = false, -- hgcommit = false,
@@ -49,11 +49,11 @@ require("copilot").setup({
-- hypr = false, -- hypr = false,
-- ["."] = false, -- ["."] = false,
}, },
copilot_node_command = 'node', copilot_node_command = "node",
server_opts_overrides = {}, server_opts_overrides = {},
vim.api.nvim_create_autocmd({ "VimLeavePre" }, { vim.api.nvim_create_autocmd({ "VimLeavePre" }, {
callback = function() callback = function()
vim.cmd( "CopilotChatSave AutoSave" ) vim.cmd "CopilotChatSave AutoSave"
end, end,
}), }),
}) }
+3 -1
View File
@@ -15,7 +15,8 @@ end
local capabilities = vim.tbl_deep_extend( local capabilities = vim.tbl_deep_extend(
"force", "force",
{}, {},
vim.lsp.protocol.make_client_capabilities() vim.lsp.protocol.make_client_capabilities(),
require("blink.cmp").get_lsp_capabilities()
) )
require("fidget").setup {} require("fidget").setup {}
@@ -213,6 +214,7 @@ for _, server in ipairs(flat_servers) do
bufnr bufnr
) )
end, end,
capabilities = capabilities,
}) })
lspenable(server) lspenable(server)
end end
+4
View File
@@ -3,4 +3,8 @@ require("zterm-navigator").setup {
right = "<A-Right>", right = "<A-Right>",
up = "<A-Up>", up = "<A-Up>",
down = "<A-Down>", down = "<A-Down>",
statusline = {
enabled = false,
},
} }
+1
View File
@@ -132,6 +132,7 @@ return {
-- "saadparwaiz1/cmp_luasnip", -- "saadparwaiz1/cmp_luasnip",
"j-hui/fidget.nvim", "j-hui/fidget.nvim",
"b0o/schemastore.nvim", "b0o/schemastore.nvim",
"saghen/blink.cmp",
}, },
config = function() config = function()
require "config.lspconfig" require "config.lspconfig"