From b51479362becb5e0341b9c3fb0a71f4d07d87866 Mon Sep 17 00:00:00 2001 From: Ariel D'Alessandro Date: Sun, 24 Oct 2021 22:47:51 +0200 Subject: Update to use nvim-cmp instead of compe --- lua/alpha/completition.lua | 58 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 lua/alpha/completition.lua (limited to 'lua/alpha/completition.lua') diff --git a/lua/alpha/completition.lua b/lua/alpha/completition.lua new file mode 100644 index 0000000..1fff833 --- /dev/null +++ b/lua/alpha/completition.lua @@ -0,0 +1,58 @@ +local lspkind = require "lspkind" +lspkind.init() + +local cmp = require "cmp" + +cmp.setup { + mapping = { + [""] = cmp.mapping.scroll_docs(-4), + [""] = cmp.mapping.scroll_docs(4), + [""] = cmp.mapping.close(), + [""] = cmp.mapping.confirm { + behavior = cmp.ConfirmBehavior.Insert, + select = true, + }, + [""] = cmp.mapping.complete(), + }, + sources = { + { name = "nvim_lua" }, + + { name = "nvim_lsp" }, + { name = "path" }, + { name = "luasnip" }, + { name = "buffer", keyword_length = 5 }, + }, + + snippet = { + expand = function(args) + require("luasnip").lsp_expand(args.body) + end, + }, + + formatting = { + format = lspkind.cmp_format { + with_text = true, + buffer = "[buf]", + nvim_lsp = "[LSP]", + nvim_lua = "[api]", + path = "[path]", + luasnip = "[snip]", + } + }, + + experimental = { + native_menu = false, + + ghost_text = true, + } +} + +-- local Group = require("colorbuddy.group").Group +-- local g = require("colorbuddy.group").groups +-- local s = require("colorbuddy.style").styles + +-- Group.new("CmpItemAbbr", g.Comment) +-- Group.new("CmpItemAbbrDeprecated", g.Error) +-- Group.new("CmpItemAbbrMatchFuzzy", g.CmpItemAbbr.fg:dark(), nil, s.italic) +-- Group.new("CmpItemKind", g.Special) +-- Group.new("CmpItemMenu", g.NonText) -- cgit v1.2.3