diff --git a/.config/nvim/lua/plugin/cmp.lua b/.config/nvim/lua/plugin/cmp.lua index 92e29b2..4155b68 100644 --- a/.config/nvim/lua/plugin/cmp.lua +++ b/.config/nvim/lua/plugin/cmp.lua @@ -17,6 +17,45 @@ end -- If you want insert `(` after select function or method item cmp.event:on( 'confirm_done', cmp_autopairs.on_confirm_done({ map_char = { tex = '' } })) +-- Custom item icons +local icons = { + Class = "  ", + Color = "  ", + Constant = " µ ", + Constructor = "  ", + Enum = "  ", + EnumMember = "  ", + Event = "  ", + Field = "  ", + File = "  ", + Folder = "  ", + Function = "  ", + Keyword = "  ", + Interface = "  ", + Method = "  ", + Module = "  ", + Operator = "  ", + Property = "  ", + Reference = "  ", + Snippet = "  ", + Struct = "  ", + Text = "  ", + TypeParameter = "  ", + Unit = "  ", + Value = "  ", + Variable = "  ", +} + + +local function icons_setup() + local kinds = vim.lsp.protocol.CompletionItemKind + for i, kind in ipairs(kinds) do + kinds[i] = icons[kind] or kind + end +end + + + cmp.setup { completion = { autocomplete = false @@ -33,6 +72,7 @@ cmp.setup { }, formatting = { format = function(entry, vim_item) + vim_item.kind = icons[vim_item.kind] vim_item.menu = ({ nvim_lsp = "[lsp]", nvim_lua = "[nvim]", diff --git a/.config/nvim/lua/plugin/lsp_config.lua b/.config/nvim/lua/plugin/lsp_config.lua index fb00539..e593c90 100644 --- a/.config/nvim/lua/plugin/lsp_config.lua +++ b/.config/nvim/lua/plugin/lsp_config.lua @@ -3,8 +3,6 @@ -- License : GPLv3 -- Description : neovim lsp config file -local M = {} - vim.fn.sign_define( "DiagnosticSignError", { @@ -37,41 +35,3 @@ vim.fn.sign_define( numhl = "DiagnosticSignInfo" } ) - -M.icons = { - Class = "  ", - Color = "  ", - Constant = " µ ", - Constructor = "  ", - Enum = "  ", - EnumMember = "  ", - Event = "  ", - Field = "  ", - File = "  ", - Folder = "  ", - Function = "  ", - Keyword = "  ", - Interface = "  ", - Method = "  ", - Module = "  ", - Operator = "  ", - Property = "  ", - Reference = "  ", - Snippet = "  ", - Struct = "  ", - Text = "  ", - TypeParameter = "  ", - Unit = "  ", - Value = "  ", - Variable = "  ", -} - - -function M.setup() - local kinds = vim.lsp.protocol.CompletionItemKind - for i, kind in ipairs(kinds) do - kinds[i] = M.icons[kind] or kind - end -end - -return M diff --git a/.config/nvim/lua/plugin/packer.lua b/.config/nvim/lua/plugin/packer.lua index dddeee8..9ab4a3b 100644 --- a/.config/nvim/lua/plugin/packer.lua +++ b/.config/nvim/lua/plugin/packer.lua @@ -58,7 +58,7 @@ return require("packer").startup(function() requires = { "neovim/nvim-lspconfig", config = function() - require("plugin.lsp_config").setup() end + require("plugin.lsp_config") end }, config = function() require("plugin.lsp_installer") end }