From 59ab00e081d92db8760d65f3146f4156a962d5e4 Mon Sep 17 00:00:00 2001 From: Elvis Claros Castro Date: Thu, 22 Aug 2024 09:33:40 -0300 Subject: Feat: add codeium and icons cmp --- lua/pi/completition/init.lua | 89 +++++++++++++++++++++++++------------------- 1 file changed, 50 insertions(+), 39 deletions(-) (limited to 'lua/pi/completition/init.lua') diff --git a/lua/pi/completition/init.lua b/lua/pi/completition/init.lua index 667e30b..ec128a0 100644 --- a/lua/pi/completition/init.lua +++ b/lua/pi/completition/init.lua @@ -55,12 +55,28 @@ cmp.setup { [""] = cmp.mapping.complete(), }, sources = { - { name = "dictionary" }, + { name = "dictionary", keyword_length = 2}, { name = "nvim_lua" }, { name = "nvim_lsp" }, { name = "path" }, { name = "luasnip" }, { name = "copilot" }, + {name = "codeium"}, + { name = 'html-css', + option = { + max_count = {}, -- not ready yet + enable_on = { + "html", + "css" + }, -- set the file types you want the plugin to work on + file_extensions = { "css", "sass", "less" }, -- set the local filetypes from which you want to derive classes + style_sheets = { + -- example of remote styles, only css no js for now + "https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css", + "https://cdn.jsdelivr.net/npm/bulma@0.9.4/css/bulma.min.css", + } + } + }, { name = "buffer", keyword_length = 4, @@ -87,46 +103,40 @@ cmp.setup { formatting = { format = function (entry, vim_item) - lspkind.cmp_format { - with_text = true, - menu = { - buffer = "[buf]", - nvim_lsp = "[ ]", - nvim_lua = "[api]", - path = "[path]", - luasnip = "[snip]", - copilot = "[ﮧ ]", - ["vim-dadbod-completion"] = "[DB]", - }, - } + if entry.source.name == "html-css" then + vim_item.menu = entry.completion_item.menu + end local KIND_ICONS = { Tailwind = '󰹞󰹞󰹞󰹞󰹞󰹞󰹞󰹞', - Color = ' ', - -- Class = 7, - -- Constant = '󰚞', - -- Constructor = 4, - -- Enum = 13, - -- EnumMember = 20, - -- Event = 23, - -- Field = 5, - -- File = 17, - -- Folder = 19, - -- Function = 3, - -- Interface = 8, - -- Keyword = 14, - -- Method = 2, - -- Module = 9, - -- Operator = 24, - -- Property = 10, - -- Reference = 18, - Snippet = " ", - -- Struct = 22, - -- Text = "", - -- TypeParameter = 25, - -- Unit = 11, - -- Value = 12, - -- Variable = 6 + Copilot = "", + Text = "󰉿", + Method = "󰆧", + Function = "󰊕", + Constructor = "", + Field = "󰜢", + Variable = "󰀫", + Class = "󰠱", + Interface = "", + Module = "", + Property = "󰜢", + Unit = "󰑭", + Value = "󰎠", + Enum = "", + Keyword = "󰌋", + Snippet = "", + Color = "󰏘", + File = "󰈙", + Reference = "󰈇", + Folder = "󰉋", + EnumMember = "", + Constant = "󰏿", + Struct = "󰙅", + Event = "", + Operator = "󰆕", + Codeium = "", + TypeParameter = "󰜅", } + if vim_item.kind == 'Color' and entry.completion_item.documentation then local _, _, r, g, b = ---@diagnostic disable-next-line: param-type-mismatch @@ -167,7 +177,8 @@ cmp.setup { }, } -vim.api.nvim_set_hl(0, "CmpItemKindCopilot", { fg = "#6CC644" }) +vim.api.nvim_set_hl(0, "CmpItemKindCopilot", { fg = "#3426C3" }) +vim.api.nvim_set_hl(0, "CmpItemKindCodeium", { fg = "#2ACDBA" }) -- Set configuration for specific filetype. cmp.setup.filetype("gitcommit", { -- cgit v1.2.3