From c42a29d50972dfdb3d7bc580b57dd746f4c50990 Mon Sep 17 00:00:00 2001 From: Zacharias-Brohn Date: Thu, 15 Jan 2026 23:13:52 +0100 Subject: [PATCH] test --- lua/config/blink-copilot.lua | 6 ++ lua/config/blink.lua | 136 ++++++++++++++++++++++++++++----- lua/config/copilot.lua | 20 ++--- lua/config/lspconfig.lua | 4 +- lua/config/zterm-navigator.lua | 4 + lua/plugins/init.lua | 1 + 6 files changed, 141 insertions(+), 30 deletions(-) create mode 100644 lua/config/blink-copilot.lua diff --git a/lua/config/blink-copilot.lua b/lua/config/blink-copilot.lua new file mode 100644 index 0000000..0469468 --- /dev/null +++ b/lua/config/blink-copilot.lua @@ -0,0 +1,6 @@ +return { + opts = { + max_completions = 1, + max_attempts = 2, + }, +} diff --git a/lua/config/blink.lua b/lua/config/blink.lua index e125e2e..2ede070 100644 --- a/lua/config/blink.lua +++ b/lua/config/blink.lua @@ -23,37 +23,101 @@ M.components = { highlight = function(ctx) return ctx.kind end, - } + }, } local opts = { - 'saghen/blink.cmp', - dependencies = { 'rafamadriz/friendly-snippets' }, + "saghen/blink.cmp", + dependencies = { + "rafamadriz/friendly-snippets", + { + "fang2hou/blink-copilot", + config = function() + require "config.blink-copilot" + end, + }, + }, - - version = '1.*', + version = "1.*", opts = { keymap = { - preset = 'enter', - [""] = { "select_next", "fallback" }, - [""] = { "select_prev", "fallback" }, + [""] = { + function(cmp) + if cmp.is_visible() then + return cmp.select_next() + end + + if cmp.snippet_active() then + return cmp.snippet_forward() + end + + return cmp.fallback() + end, + }, + [""] = { + 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, + }, + [""] = { "accept", "fallback" }, + ["Up"] = {}, + ["Down"] = {}, }, appearance = { - nerd_font_variant = 'mono' + nerd_font_variant = "mono", + }, + + cmdline = { + completion = { + menu = { auto_show = true }, + list = { selection = { preselect = false } }, + }, + + keymap = { + [""] = { + function(cmp) + if cmp.is_visible() then + return cmp.select_next() + end + + return cmp.fallback() + end, + }, + [""] = { + function(cmp) + if cmp.is_visible() then + return cmp.select_prev() + end + + return cmp.fallback() + end, + }, + [""] = { "accept", "fallback" }, + ["Up"] = {}, + ["Down"] = {}, + }, }, completion = { documentation = { auto_show = true, auto_show_delay_ms = 50 }, keyword = { range = "full" }, - accept = { auto_brackets = { enabled = false }}, + accept = { auto_brackets = { enabled = true } }, ghost_text = { enabled = true }, list = { selection = { - preselect = true, + -- preselect = false, auto_insert = false, - } + }, }, menu = { @@ -61,23 +125,57 @@ local opts = { border = "single", draw = { padding = 1, - columns = {{ "kind_icon" }, { "label" }, { "kind" }}, + columns = { + { "kind_icon" }, + { "label", "label_description", gap = 1 }, + { "kind" }, + }, components = M.components, - } - } + }, + }, }, + signature = { enabled = true }, + 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 = { - 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 diff --git a/lua/config/copilot.lua b/lua/config/copilot.lua index 5092bd2..3656d05 100644 --- a/lua/config/copilot.lua +++ b/lua/config/copilot.lua @@ -1,21 +1,21 @@ -require("copilot").setup({ +require("copilot").setup { panel = { - enabled = true, + enabled = false, auto_refresh = true, keymap = { jump_prev = "[[", jump_next = "]]", accept = "", refresh = "gr", - open = "" + open = "", }, layout = { position = "bottom", -- | top | left | right | horizontal | vertical - ratio = 0.4 + ratio = 0.4, }, }, suggestion = { - enabled = true, + enabled = false, auto_trigger = true, hide_during_completion = true, debounce = 75, @@ -30,8 +30,8 @@ require("copilot").setup({ }, filetypes = { -- yaml = false, - -- markdown = false, - -- help = false, + markdown = true, + help = true, -- gitcommit = false, -- gitrebase = false, -- hgcommit = false, @@ -49,11 +49,11 @@ require("copilot").setup({ -- hypr = false, -- ["."] = false, }, - copilot_node_command = 'node', + copilot_node_command = "node", server_opts_overrides = {}, vim.api.nvim_create_autocmd({ "VimLeavePre" }, { callback = function() - vim.cmd( "CopilotChatSave AutoSave" ) + vim.cmd "CopilotChatSave AutoSave" end, }), -}) +} diff --git a/lua/config/lspconfig.lua b/lua/config/lspconfig.lua index 8efedca..44c13ed 100644 --- a/lua/config/lspconfig.lua +++ b/lua/config/lspconfig.lua @@ -15,7 +15,8 @@ end local capabilities = vim.tbl_deep_extend( "force", {}, - vim.lsp.protocol.make_client_capabilities() + vim.lsp.protocol.make_client_capabilities(), + require("blink.cmp").get_lsp_capabilities() ) require("fidget").setup {} @@ -213,6 +214,7 @@ for _, server in ipairs(flat_servers) do bufnr ) end, + capabilities = capabilities, }) lspenable(server) end diff --git a/lua/config/zterm-navigator.lua b/lua/config/zterm-navigator.lua index 0fc3cd0..6452c69 100644 --- a/lua/config/zterm-navigator.lua +++ b/lua/config/zterm-navigator.lua @@ -3,4 +3,8 @@ require("zterm-navigator").setup { right = "", up = "", down = "", + + statusline = { + enabled = false, + }, } diff --git a/lua/plugins/init.lua b/lua/plugins/init.lua index ef0b07d..4ee9bd9 100644 --- a/lua/plugins/init.lua +++ b/lua/plugins/init.lua @@ -132,6 +132,7 @@ return { -- "saadparwaiz1/cmp_luasnip", "j-hui/fidget.nvim", "b0o/schemastore.nvim", + "saghen/blink.cmp", }, config = function() require "config.lspconfig"