From c94599346a6b0a95a98dd79e2832c503fb502b4d Mon Sep 17 00:00:00 2001 From: Oliver Hartmann Date: Sat, 21 Dec 2024 00:30:11 +0100 Subject: [PATCH] switch to blink --- lua/plugins/blink.lua | 37 ++++++++++++++++++++++++++++++------- lua/plugins/cmp.lua | 1 + lua/plugins/codium.lua | 2 +- lua/plugins/copilot.lua | 1 - lua/plugins/lspconfig.lua | 4 ++-- 5 files changed, 34 insertions(+), 11 deletions(-) diff --git a/lua/plugins/blink.lua b/lua/plugins/blink.lua index a917844..7061fc4 100644 --- a/lua/plugins/blink.lua +++ b/lua/plugins/blink.lua @@ -2,7 +2,19 @@ return { 'saghen/blink.cmp', lazy = false, -- lazy loading handled internally -- optional: provides snippets for the snippet source - dependencies = 'rafamadriz/friendly-snippets', + dependencies = { + 'rafamadriz/friendly-snippets', + 'giuxtaposition/blink-cmp-copilot', + { + 'saghen/blink.compat', + -- use the latest release, via version = '*', if you also use the latest release for blink.cmp + version = '*', + -- lazy.nvim will automatically load the plugin when it's required by blink.cmp + lazy = true, + -- make sure to set opts so that lazy.nvim calls blink.compat's setup + opts = {}, + }, + }, -- use a release tag to download pre-built binaries version = 'v0.*', @@ -32,14 +44,26 @@ return { -- default list of enabled providers defined so that you can extend it -- elsewhere in your config, without redefining it, via `opts_extend` sources = { - default = { 'lsp', 'path', 'snippets', 'buffer' }, + default = { 'lsp', 'path', 'snippets', 'buffer', 'copilot', 'codeium' }, -- optionally disable cmdline completions -- cmdline = {}, + providers = { + copilot = { + name = 'copilot', + module = 'blink-cmp-copilot', + score_offset = 100, + async = true, + }, + codeium = { -- TODO: Replace with https://github.com/Exafunction/codeium.nvim/pull/264 + name = 'codeium', -- IMPORTANT: use the same name as you would for nvim-cmp + module = 'blink.compat.source', + }, + }, }, completion = { list = { - selection = 'auto_insert', + selection = 'manual', }, menu = { max_height = 25, @@ -55,16 +79,15 @@ return { }, documentation = { auto_show = true, - auto_show_delay = 300, + auto_show_delay_ms = 300, }, - signature = { enabled = true } }, -- experimental signature help support - -- signature = { enabled = true } + signature = { enabled = true } }, -- allows extending the providers array elsewhere in your config -- without having to redefine it opts_extend = { 'sources.default' }, - enabled = false + enabled = true } diff --git a/lua/plugins/cmp.lua b/lua/plugins/cmp.lua index f3081e0..450aae5 100644 --- a/lua/plugins/cmp.lua +++ b/lua/plugins/cmp.lua @@ -213,4 +213,5 @@ return { local cmp_autopairs = require('nvim-autopairs.completion.cmp') cmp.event:on('confirm_done', cmp_autopairs.on_confirm_done({ map_char = { tex = '' } })) end, + enabled = false } diff --git a/lua/plugins/codium.lua b/lua/plugins/codium.lua index 13ffd0a..79ab97c 100644 --- a/lua/plugins/codium.lua +++ b/lua/plugins/codium.lua @@ -2,9 +2,9 @@ return { 'Exafunction/codeium.nvim', requires = { 'nvim-lua/plenary.nvim', - 'hrsh7th/nvim-cmp', }, config = function() require('codeium').setup({}) end, + enabled = true } diff --git a/lua/plugins/copilot.lua b/lua/plugins/copilot.lua index 818c0fd..f7ded21 100644 --- a/lua/plugins/copilot.lua +++ b/lua/plugins/copilot.lua @@ -19,7 +19,6 @@ return { suggestion = { enabled = false, auto_trigger = false }, panel = { enabled = false }, }) - require("copilot_cmp").setup() end, } diff --git a/lua/plugins/lspconfig.lua b/lua/plugins/lspconfig.lua index 4dce675..cd68b92 100644 --- a/lua/plugins/lspconfig.lua +++ b/lua/plugins/lspconfig.lua @@ -119,8 +119,8 @@ return { require('nvim-navic').setup({}) local capabilities = vim.lsp.protocol.make_client_capabilities() - capabilities = require('cmp_nvim_lsp').default_capabilities(capabilities) - -- capabilities = require('blink.cmp').get_lsp_capabilities(capabilities) + -- capabilities = require('cmp_nvim_lsp').default_capabilities(capabilities) + capabilities = require('blink.cmp').get_lsp_capabilities(capabilities) capabilities.workspace = { didChangeWatchedFiles = { dynamicRegistration = true,