From 9d0051e6b4170851ebcc09e7ff44097818c8e1dc Mon Sep 17 00:00:00 2001 From: seth Date: Sun, 17 Sep 2023 04:54:00 -0400 Subject: start using willruggiano/neovim.nix --- plugins/cmp.lua | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 plugins/cmp.lua (limited to 'plugins/cmp.lua') diff --git a/plugins/cmp.lua b/plugins/cmp.lua new file mode 100644 index 0000000..a61dc4a --- /dev/null +++ b/plugins/cmp.lua @@ -0,0 +1,38 @@ +return function() + local cmp = require("cmp") + local luasnip = require("luasnip") + local mapping = cmp.mapping + + return { + completion = { + completeopt = "menu,menuone,noinsert", + }, + + snippet = { + expand = function(args) + luasnip.lsp_expand(args.body) + end, + }, + + mapping = mapping.preset.insert({ + [""] = mapping.select_next_item({ behavior = cmp.SelectBehavior.Insert }), + [""] = mapping.select_prev_item({ behavior = cmp.SelectBehavior.Insert }), + [""] = mapping.scroll_docs(-4), + [""] = mapping.scroll_docs(4), + [""] = mapping.complete(), + [""] = mapping.abort(), + [""] = mapping.confirm({ select = true }), + [""] = mapping.confirm({ + behavior = cmp.ConfirmBehavior.Replace, + select = true, + }), + }), + + sources = cmp.config.sources({ + { name = "nvim_lsp" }, + { name = "luasnip" }, + { name = "async_path" }, + { name = "buffer" }, + }), + } +end -- cgit v1.2.3