From 5d2276101431f39714650b5f0ae548f2d0c924ec Mon Sep 17 00:00:00 2001 From: Martin Larsson Date: Thu, 14 Nov 2024 17:03:34 +0100 Subject: [PATCH] Update blink config so super-tab works. Also add LSP capabilities for blink for more suggestions. --- home/.config/nvim/lua/plugs/blink.lua | 29 ++++++----------------- home/.config/nvim/lua/plugs/mason_lsp.lua | 5 ++-- 2 files changed, 10 insertions(+), 24 deletions(-) diff --git a/home/.config/nvim/lua/plugs/blink.lua b/home/.config/nvim/lua/plugs/blink.lua index ff2b0a4..c541004 100644 --- a/home/.config/nvim/lua/plugs/blink.lua +++ b/home/.config/nvim/lua/plugs/blink.lua @@ -1,33 +1,18 @@ return { "saghen/blink.cmp", - lazy = false, -- lazy loading handled internally - - -- use a release tag to download pre-built binaries + lazy = false, version = "v0.*", - -- OR build from source, requires nightly: https://rust-lang.github.io/rustup/concepts/channels.html#working-with-nightly-rust - -- build = 'cargo build --release', - -- On musl libc based systems you need to add this flag - -- build = 'RUSTFLAGS="-C target-feature=-crt-static" cargo build --release', - -- If you use nix, you can build from source using latest nightly rust with: - -- build = 'nix run .#build-plugin', - ---@module "blink.cmp" ---@type blink.cmp.Config opts = { + keymap = { preset = "super-tab" }, + highlight = { - -- sets the fallback highlight groups to nvim-cmp's highlight groups - -- useful for when your theme doesn't support blink.cmp - -- will be removed in a future release, assuming themes add support use_nvim_cmp_as_default = true, }, - -- set to 'mono' for 'Nerd Font Mono' or 'normal' for 'Nerd Font' - -- adjusts spacing to ensure icons are aligned nerd_font_variant = "mono", - - -- experimental auto-brackets support - -- accept = { auto_brackets = { enabled = true } } - - -- experimental signature help support - -- trigger = { signature_help = { enabled = true } } - } + }, + -- allows extending the enabled_providers array elsewhere in your config + -- without having to redefining it + opts_extend = { "sources.completion.enabled_providers" } } diff --git a/home/.config/nvim/lua/plugs/mason_lsp.lua b/home/.config/nvim/lua/plugs/mason_lsp.lua index ccb937f..de19491 100644 --- a/home/.config/nvim/lua/plugs/mason_lsp.lua +++ b/home/.config/nvim/lua/plugs/mason_lsp.lua @@ -17,9 +17,9 @@ local function setup_lsp(server_names) local server_conf = get_lsp_conf(server, server_name) local capabilities = server_conf.capabilities or {} - server_conf.capabilities = capabilities - capabilities.offsetEncoding = { "utf-16" } + server_conf.capabilities = require("blink.cmp").get_lsp_capabilities(capabilities) + server_conf.on_attach = function(client, bufnr) vim.lsp.inlay_hint.enable(true, { bufnr = bufnr }) @@ -183,6 +183,7 @@ return { -- LSP config "neovim/nvim-lspconfig", + "saghen/blink.cmp", "williamboman/mason-lspconfig.nvim", -- DAP