[nvim] refactor: trim down lsp icons + remove unused functions

This commit is contained in:
David JULIEN 2022-05-01 18:30:12 +02:00
parent f0596d3c80
commit 375f82d8e6

View File

@ -19,43 +19,33 @@ 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 = " ",
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
@ -72,7 +62,8 @@ cmp.setup {
},
formatting = {
format = function(entry, vim_item)
vim_item.kind = icons[vim_item.kind]
vim_item.kind = string.format("%s %s", icons[vim_item.kind],
vim_item.kind)
vim_item.menu = ({
nvim_lsp = "[lsp]",
nvim_lua = "[nvim]",
@ -119,5 +110,8 @@ cmp.setup {
fallback()
end
end, { "i", "s" }),
}
},
view = {
entries = {name = 'custom', selection_order = 'near_cursor' }
},
}