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 ++++++++++++++++++++++++------------------- lua/plugins/codeium.lua | 11 ++++++ lua/plugins/completition.lua | 18 +-------- lua/plugins/nvim-html-css.lua | 9 +++++ 4 files changed, 71 insertions(+), 56 deletions(-) create mode 100644 lua/plugins/codeium.lua create mode 100644 lua/plugins/nvim-html-css.lua (limited to '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", { diff --git a/lua/plugins/codeium.lua b/lua/plugins/codeium.lua new file mode 100644 index 0000000..2de0def --- /dev/null +++ b/lua/plugins/codeium.lua @@ -0,0 +1,11 @@ +return { + "Exafunction/codeium.nvim", + dependencies = { + "nvim-lua/plenary.nvim", + "hrsh7th/nvim-cmp", + }, + config = function() + require("codeium").setup({ + }) + end +} diff --git a/lua/plugins/completition.lua b/lua/plugins/completition.lua index ab65317..480da46 100644 --- a/lua/plugins/completition.lua +++ b/lua/plugins/completition.lua @@ -35,23 +35,7 @@ return { } local dict = require("cmp_dictionary") - dict.setup({ - -- The following are default values. - - paths = dict_fl["*"], - exact_length = 2, - first_case_insensitive = false, - -- document = { - -- enable = true, - -- command = { "wn", "${label}", "-over" }, - -- }, - }) - - -- dict.switcher({ - -- spelllang = { - -- es = "./../../spell/dic_es.dict", - -- }, - -- }) + dict.setup({ paths = dict_fl["*"], exact_length = 3, first_case_insensitive = false }) end, }, diff --git a/lua/plugins/nvim-html-css.lua b/lua/plugins/nvim-html-css.lua new file mode 100644 index 0000000..d755f75 --- /dev/null +++ b/lua/plugins/nvim-html-css.lua @@ -0,0 +1,9 @@ +return { "Jezda1337/nvim-html-css", + dependencies = { + "nvim-treesitter/nvim-treesitter", + "nvim-lua/plenary.nvim" + }, + config = function() + require("html-css"):setup() + end +} -- cgit v1.2.3