diff --git a/pkgs/neovim-with-config/lua/plugins/completion.lua b/pkgs/neovim-with-config/lua/plugins/completion.lua index 036ff241..32f52bfe 100644 --- a/pkgs/neovim-with-config/lua/plugins/completion.lua +++ b/pkgs/neovim-with-config/lua/plugins/completion.lua @@ -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({ - [""] = cmp.mapping.select_prev_item(), - [""] = cmp.mapping.select_next_item(), - [""] = cmp.mapping.complete(), - [""] = cmp.mapping.abort(), - [""] = 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, }, diff --git a/pkgs/neovim-with-config/plugins.nix b/pkgs/neovim-with-config/plugins.nix index 89d45504..9e7a7e38 100644 --- a/pkgs/neovim-with-config/plugins.nix +++ b/pkgs/neovim-with-config/plugins.nix @@ -11,6 +11,7 @@ with vimPlugins; pluginsWithLazy true [ ChatGPT-nvim FixCursorHold-nvim + blink-cmp bufferline-nvim comment-nvim copilot-lua @@ -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 ])