[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 -- Custom item icons
local icons = { local icons = {
Class = " ", Class = "",
Color = " ", Color = "",
Constant = " µ ", Constant = "µ",
Constructor = " ", Constructor = "",
Enum = " ", Enum = "",
EnumMember = " ", EnumMember = "",
Event = " ", Event = "",
Field = " ", Field = "",
File = " ", File = "",
Folder = " ", Folder = "",
Function = " ", Function = "",
Keyword = " ", Keyword = "",
Interface = " ", Interface = "",
Method = " ", Method = "",
Module = " ", Module = "",
Operator = " ", Operator = "",
Property = " ", Property = "",
Reference = " ", Reference = "",
Snippet = " ", Snippet = "",
Struct = " ", Struct = "",
Text = " ", Text = "",
TypeParameter = " ", TypeParameter = "",
Unit = " ", Unit = "",
Value = " ", Value = "",
Variable = " ", 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 { cmp.setup {
completion = { completion = {
autocomplete = false autocomplete = false
@ -72,7 +62,8 @@ cmp.setup {
}, },
formatting = { formatting = {
format = function(entry, vim_item) 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 = ({ vim_item.menu = ({
nvim_lsp = "[lsp]", nvim_lsp = "[lsp]",
nvim_lua = "[nvim]", nvim_lua = "[nvim]",
@ -119,5 +110,8 @@ cmp.setup {
fallback() fallback()
end end
end, { "i", "s" }), end, { "i", "s" }),
} },
view = {
entries = {name = 'custom', selection_order = 'near_cursor' }
},
} }