diff options
author | tdback <tyler@tdback.net> | 2024-12-04 18:48:24 -0500 |
---|---|---|
committer | tdback <tyler@tdback.net> | 2024-12-04 18:48:24 -0500 |
commit | 3b2163b821f4dbf1003804b9b19fd276dc4bc350 (patch) | |
tree | 809a679142eae8e7d3b4d2b3cf1426416883a7f9 /lua/custom/plugins/cmp.lua |
initial commit to new repo
Diffstat (limited to 'lua/custom/plugins/cmp.lua')
-rw-r--r-- | lua/custom/plugins/cmp.lua | 41 |
1 files changed, 41 insertions, 0 deletions
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 = { + ["<C-n>"] = cmp.mapping.select_next_item({ behavior = cmp.SelectBehavior.Insert }), + ["<C-p>"] = cmp.mapping.select_prev_item({ behavior = cmp.SelectBehavior.Insert }), + ["<C-y>"] = cmp.mapping.confirm({ + behavior = cmp.SelectBehavior.Insert, + select = true, + }), + ["<Tab>"] = nil, + ["<S-Tab>"] = nil, + ["<CR>"] = nil, + }, + + snippet = { expand = function(args) vim.snippet.expand(args.body) end }, + }) + end, +} |