Skip to content

Commit

Permalink
feat(neovim): switch from nvim-cmp to blink-cmp
Browse files Browse the repository at this point in the history
  • Loading branch information
natsukium committed Jan 4, 2025
1 parent ec28da3 commit ae712e6
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 52 deletions.
60 changes: 15 additions & 45 deletions pkgs/neovim-with-config/lua/plugins/completion.lua
Original file line number Diff line number Diff line change
@@ -1,53 +1,23 @@
return {
{
"nvim-cmp",
"blink.cmp",
event = { "InsertEnter", "CmdlineEnter" },
after = function()
vim.g.completeopt = "menu,menuone,noselect"
local cmp = require("cmp")
local luasnip = require("luasnip")
local lspkind = require("lspkind")
cmp.setup({
snippet = {
expand = function(args)
luasnip.lsp_expand(args.body)
end,
require("blink.cmp").setup({
completion = {
menu = {
draw = {
columns = { { "label", "label_description", gap = 1 }, { "kind_icon", "kind" } },
treesitter = { "lsp" },
},
},
documentation = {
auto_show = true,
auto_show_delay_ms = 500,
treesitter_highlighting = true,
},
},
sources = cmp.config.sources({
{ name = "copilot" },
{ name = "nvim_lsp" },
{ name = "luasnip" },
{ name = "path" },
{ name = "buffer" },
}),
mapping = cmp.mapping.preset.insert({
["<C-p>"] = cmp.mapping.select_prev_item(),
["<C-n>"] = cmp.mapping.select_next_item(),
["<C-l>"] = cmp.mapping.complete(),
["<C-e>"] = cmp.mapping.abort(),
["<CR>"] = cmp.mapping.confirm({ select = true }),
}),
window = {
completion = cmp.config.window.bordered(),
documentation = cmp.config.window.bordered(),
},
formatting = {
format = lspkind.cmp_format({}),
},
})
cmp.setup.cmdline("/", {
mapping = cmp.mapping.preset.cmdline(),
source = {
{ name = "buffer" },
},
})
cmp.setup.cmdline(":", {
mapping = cmp.mapping.preset.cmdline(),
sources = cmp.config.sources({
{ name = "path" },
}, {
{ name = "cmdline" },
}),
signature = { enabled = true },
})
end,
},
Expand Down
8 changes: 1 addition & 7 deletions pkgs/neovim-with-config/plugins.nix
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ with vimPlugins;
pluginsWithLazy true [
ChatGPT-nvim
FixCursorHold-nvim
blink-cmp
bufferline-nvim
comment-nvim
copilot-lua
Expand Down Expand Up @@ -61,12 +62,5 @@ pluginsWithLazy true [
nvim-web-devicons
# don't make nvim-cmp related packages lazy loading
# https://github.com/nvim-neorocks/lz.n/wiki/lazy%E2%80%90loading-nvim%E2%80%90cmp-and-its-extensions
nvim-cmp
cmp-buffer
cmp-cmdline
cmp-nvim-lsp
cmp-path
cmp_luasnip
copilot-cmp
lspkind-nvim
])

0 comments on commit ae712e6

Please sign in to comment.