From dec8d36cbdbb3b9c5c12792ed199892ce2e82069 Mon Sep 17 00:00:00 2001 From: seth Date: Sun, 31 Dec 2023 08:01:03 -0500 Subject: back to regular lua --- config/plugins/cmp.lua | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 config/plugins/cmp.lua (limited to 'config/plugins/cmp.lua') diff --git a/config/plugins/cmp.lua b/config/plugins/cmp.lua new file mode 100644 index 0000000..eee5eb1 --- /dev/null +++ b/config/plugins/cmp.lua @@ -0,0 +1,42 @@ +local cmp = require("cmp") + +cmp.setup({ + completion = { + compleopt = "menu,menuone,insert", + }, + + snippet = { + expand = function(args) + require("luasnip").lsp_expand(args.body) + end, + }, + + mapping = { + [""] = cmp.mapping.select_next_item({ behavior = cmp.SelectBehavior.Insert }), + [""] = cmp.mapping.select_prev_item({ behavior = cmp.SelectBehavior.Insert }), + [""] = cmp.mapping.scroll_docs(-4), + [""] = cmp.mapping.scroll_docs(4), + [""] = cmp.mapping.complete(), + [""] = cmp.mapping.abort(), + [""] = cmp.mapping({ + i = function(fallback) + if cmp.visible() and cmp.get_active_entry() then + cmp.confirm({ behavior = cmp.ConfirmBehavior.Replace, select = false }) + else + fallback() + end + end, + + s = cmp.mapping.confirm({ select = true }), + c = cmp.mapping.confirm({ behavior = cmp.ConfirmBehavior.Replace, select = true }), + }), + }, + + sources = cmp.config.sources({ + { name = "nvim_lsp" }, + { name = "luasnip" }, + { name = "async_path" }, + { name = "buffer" }, + { name = "rg" }, + }), +}) -- cgit v1.2.3