From 8f9c77878f8742a47d34a50748023d1b552cfbf1 Mon Sep 17 00:00:00 2001 From: mirenn Date: Mon, 21 Sep 2026 23:09:33 +0200 Subject: guix primer --- .../dotfiles/.config/nvim/lua/plugins/nvim-cmp.lua | 64 ++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 mirenn/home/files/dotfiles/.config/nvim/lua/plugins/nvim-cmp.lua (limited to 'mirenn/home/files/dotfiles/.config/nvim/lua/plugins/nvim-cmp.lua') diff --git a/mirenn/home/files/dotfiles/.config/nvim/lua/plugins/nvim-cmp.lua b/mirenn/home/files/dotfiles/.config/nvim/lua/plugins/nvim-cmp.lua new file mode 100644 index 0000000..b7d71a3 --- /dev/null +++ b/mirenn/home/files/dotfiles/.config/nvim/lua/plugins/nvim-cmp.lua @@ -0,0 +1,64 @@ +local config = function() + local cmp = require("cmp") + vim.opt.completeopt = "menu,menuone" + + cmp.setup({ + formatting = { + expandable_indicator = false, + fields = { "abbr", "kind" }, + format = require("lspkind").cmp_format({ + mode = "text_symbol", + maxwidth = function() return math.floor(0.45 * vim.o.columns) end, + ellipsis_char = "...", -- when popup menu exceed maxwidth, the truncated part would show ellipsis_char instead (must define maxwidth first) + before = function(_, vim_item) + vim_item.menu = "" + return vim_item + end + }) + }, + snippet = { + expand = function(args) + vim.snippet.expand(args.body) + end, + }, + window = { + completion = cmp.config.window.bordered(), + documentation = cmp.config.window.bordered(), + }, + mapping = { + [""] = cmp.mapping.select_next_item(), + [""] = cmp.mapping.scroll_docs(-4), + [""] = cmp.mapping.scroll_docs(4), + [""] = cmp.mapping.complete(), + [""] = cmp.mapping.abort(), + [""] = cmp.mapping.confirm({ select = true }), + }, + sources = cmp.config.sources( + { + { name = "lazydev", group_index = 0 } + }, { + { name = "neorg" } + }, { + { name = "nvim_lsp" }, + }, { + { name = "path" }, + }, { + { name = "buffer" }, + } + ) + }) +end + +return { + "hrsh7th/nvim-cmp", + lazy = true, + event = "InsertEnter", + config = config, + dependencies = { + "neovim/nvim-lspconfig", + "onsails/lspkind.nvim", + "hrsh7th/cmp-nvim-lsp", + "hrsh7th/cmp-buffer", + "hrsh7th/cmp-path", + }, +} -- cgit v1.2.3