From 38e77e8fcd870840066f7d837301b9e40427f894 Mon Sep 17 00:00:00 2001 From: Michael Housh Date: Thu, 19 Dec 2024 11:20:54 -0500 Subject: [PATCH] feat: Trying blink.cmp for completions. --- nvim/m-housh/lua/user/plugin/blink.lua | 29 ++++++++++++++++++++++++++ nvim/m-housh/lua/user/plugin/cmp.lua | 1 + nvim/m-housh/lua/user/plugin/lsp.lua | 8 ++++--- 3 files changed, 35 insertions(+), 3 deletions(-) create mode 100644 nvim/m-housh/lua/user/plugin/blink.lua diff --git a/nvim/m-housh/lua/user/plugin/blink.lua b/nvim/m-housh/lua/user/plugin/blink.lua new file mode 100644 index 0000000..9131dd3 --- /dev/null +++ b/nvim/m-housh/lua/user/plugin/blink.lua @@ -0,0 +1,29 @@ +return { + "saghen/blink.cmp", + dependencies = { + "rafamadriz/friendly-snippets", + "L3MON4D3/LuaSnip", + }, + version = "v0.7.6", + opts = { + keymap = { preset = "default" }, + snippets = { + expand = function(snippet) + require("luasnip").lsp_expand(snippet) + end, + active = function(filter) + if filter and filter.direction then + return require("luasnip").jumpable(filter.direction) + end + return require("luasnip").in_snippet() + end, + jump = function(direction) + require("luasnip").jump(direction) + end, + }, + sources = { + default = { "lsp", "path", "luasnip", "buffer" }, + }, + }, + opts_extend = { "sources.default" }, +} diff --git a/nvim/m-housh/lua/user/plugin/cmp.lua b/nvim/m-housh/lua/user/plugin/cmp.lua index 3e59418..a2632a1 100755 --- a/nvim/m-housh/lua/user/plugin/cmp.lua +++ b/nvim/m-housh/lua/user/plugin/cmp.lua @@ -1,5 +1,6 @@ return { "hrsh7th/nvim-cmp", + enabled = false, event = "InsertEnter", dependencies = { "hrsh7th/cmp-nvim-lsp", diff --git a/nvim/m-housh/lua/user/plugin/lsp.lua b/nvim/m-housh/lua/user/plugin/lsp.lua index 2be35fb..78e13c9 100755 --- a/nvim/m-housh/lua/user/plugin/lsp.lua +++ b/nvim/m-housh/lua/user/plugin/lsp.lua @@ -15,7 +15,8 @@ return { "neovim/nvim-lspconfig", event = { "BufReadPre", "BufNewFile" }, dependencies = { - "hrsh7th/cmp-nvim-lsp", + -- "hrsh7th/cmp-nvim-lsp", + "saghen/blink.cmp", { "antosha417/nvim-lsp-file-operations", config = true }, "williamboman/mason.nvim", "williamboman/mason-lspconfig.nvim", @@ -37,8 +38,9 @@ return { }, }) local lspconfig = require("lspconfig") - local cmp_nvim_lsp = require("cmp_nvim_lsp") - local capabilities = cmp_nvim_lsp.default_capabilities() + --local cmp_nvim_lsp = require("cmp_nvim_lsp") + --local capabilities = cmp_nvim_lsp.default_capabilities() + local capabilities = require("blink.cmp").get_lsp_capabilities() local opts = { noremap = true, silent = true } local on_attach = function(_, bufnr) opts.buffer = bufnr