config(nvim): replace hrsh7th/nvim-cmp with saghen/blink.cmp

main
sudo pacman -Syu 2024-10-28 01:44:46 +07:00
parent 73046e3cb8
commit c1791cb774
1 changed files with 14 additions and 60 deletions

View File

@ -203,56 +203,21 @@ require("lazy").setup({
end, end,
}, },
-- https://github.com/hrsh7th/nvim-cmp -- https://github.com/Saghen/blink.cmp
{ {
"hrsh7th/nvim-cmp", "saghen/blink.cmp",
event = "InsertEnter", version = "v0.*",
dependencies = { opts = {
"hrsh7th/cmp-nvim-lsp", keymap = {
"hrsh7th/cmp-buffer", select_and_accept = { "<CR>" },
-- https://github.com/onsails/lspkind.nvim },
"onsails/lspkind.nvim", windows = {
autocomplete = {
auto_show = false,
},
},
nerd_font_variant = "mono",
}, },
config = function()
local cmp = require("cmp")
local lspkind = require("lspkind")
cmp.setup({
-- Custom
completion = {
autocomplete = false,
},
preselect = cmp.PreselectMode.None,
-- Largely copy from GitHub
mapping = cmp.mapping.preset.insert({
["<C-Space>"] = cmp.mapping.complete(),
["<CR>"] = cmp.mapping.confirm(),
["<C-e>"] = cmp.mapping.abort(),
}),
sources = cmp.config.sources({
{ name = "nvim_lsp" },
}, {
{
name = "buffer",
option = {
-- All buffers
get_bufnrs = function()
return vim.api.nvim_list_bufs()
end,
},
},
}),
formatting = {
format = lspkind.cmp_format({
mode = "symbol",
maxwidth = 50,
ellipsis_char = "...",
show_labelDetails = true,
}),
},
})
end,
}, },
-- https://github.com/tpope/vim-projectionist -- https://github.com/tpope/vim-projectionist
@ -504,30 +469,19 @@ require("lazy").setup({
"python", "python",
"typst", "typst",
}, },
dependencies = {
"hrsh7th/nvim-cmp",
},
config = function() config = function()
local lspconfig = require("lspconfig") local lspconfig = require("lspconfig")
-- https://github.com/hrsh7th/cmp-nvim-lsp
-- https://github.com/hrsh7th/nvim-cmp/discussions/759
local capabilities = require("cmp_nvim_lsp").default_capabilities()
capabilities.textDocument.completion.completionItem.snippetSupport = false
-- Go -- Go
-- https://github.com/golang/tools/blob/master/gopls/doc/vim.md -- https://github.com/golang/tools/blob/master/gopls/doc/vim.md
-- https://github.com/golang/tools/blob/master/gopls/doc/settings.md -- https://github.com/golang/tools/blob/master/gopls/doc/settings.md
-- https://github.com/neovim/nvim-lspconfig/blob/master/doc/configs.md#gopls -- https://github.com/neovim/nvim-lspconfig/blob/master/doc/configs.md#gopls
-- https://github.com/neovim/nvim-lspconfig/issues/2542 -- https://github.com/neovim/nvim-lspconfig/issues/2542
lspconfig.gopls.setup({ lspconfig.gopls.setup({})
capabilities = capabilities,
})
-- Python -- Python
-- https://github.com/neovim/nvim-lspconfig/blob/master/doc/configs.md#pyright -- https://github.com/neovim/nvim-lspconfig/blob/master/doc/configs.md#pyright
lspconfig.pyright.setup({ lspconfig.pyright.setup({
capabilities = capabilities,
settings = { settings = {
pyright = { pyright = {
-- Conflicts with Ruff -- Conflicts with Ruff