From 3b2163b821f4dbf1003804b9b19fd276dc4bc350 Mon Sep 17 00:00:00 2001 From: tdback Date: Wed, 4 Dec 2024 18:48:24 -0500 Subject: initial commit to new repo --- lua/custom/plugins/cmp.lua | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 lua/custom/plugins/cmp.lua (limited to 'lua/custom/plugins/cmp.lua') diff --git a/lua/custom/plugins/cmp.lua b/lua/custom/plugins/cmp.lua new file mode 100644 index 0000000..b092f65 --- /dev/null +++ b/lua/custom/plugins/cmp.lua @@ -0,0 +1,41 @@ +return { + "hrsh7th/nvim-cmp", + dependencies = { + "hrsh7th/cmp-nvim-lsp", + "hrsh7th/cmp-buffer", + "hrsh7th/cmp-path", + "L3MON4D3/LuaSnip", + "saadparwaiz1/cmp_luasnip", + }, + lazy = false, + config = function() + vim.opt.completeopt = { "menu", "menuone", "noselect" } + vim.opt.shortmess:append("c") + + local cmp = require("cmp") + cmp.setup({ + preselect = cmp.PreselectMode.Item, + + sources = { + { name = "nvim_lsp" }, + { name = "luasnip" }, + { name = "path" }, + { name = "buffer" }, + }, + + mapping = { + [""] = cmp.mapping.select_next_item({ behavior = cmp.SelectBehavior.Insert }), + [""] = cmp.mapping.select_prev_item({ behavior = cmp.SelectBehavior.Insert }), + [""] = cmp.mapping.confirm({ + behavior = cmp.SelectBehavior.Insert, + select = true, + }), + [""] = nil, + [""] = nil, + [""] = nil, + }, + + snippet = { expand = function(args) vim.snippet.expand(args.body) end }, + }) + end, +} -- cgit v1.2.3