Add custom icons for suggestions in cmp
This commit is contained in:
@@ -1,6 +1,33 @@
|
|||||||
local lsp_installer = require("nvim-lsp-installer")
|
local lsp_installer = require("nvim-lsp-installer")
|
||||||
local cmp = require("cmp")
|
local cmp = require("cmp")
|
||||||
local lspkind = require("lspkind")
|
|
||||||
|
local kind_icons = {
|
||||||
|
Text = "",
|
||||||
|
Method = "",
|
||||||
|
Function = "",
|
||||||
|
Constructor = "",
|
||||||
|
Field = "",
|
||||||
|
Variable = "",
|
||||||
|
Class = "ﴯ",
|
||||||
|
Interface = "",
|
||||||
|
Module = "",
|
||||||
|
Property = "ﰠ",
|
||||||
|
Unit = "",
|
||||||
|
Value = "",
|
||||||
|
Enum = "",
|
||||||
|
Keyword = "",
|
||||||
|
Snippet = "",
|
||||||
|
Color = "",
|
||||||
|
File = "",
|
||||||
|
Reference = "",
|
||||||
|
Folder = "",
|
||||||
|
EnumMember = "",
|
||||||
|
Constant = "",
|
||||||
|
Struct = "",
|
||||||
|
Event = "",
|
||||||
|
Operator = "",
|
||||||
|
TypeParameter = ""
|
||||||
|
}
|
||||||
|
|
||||||
cmp.setup({
|
cmp.setup({
|
||||||
snippet = {
|
snippet = {
|
||||||
@@ -29,14 +56,17 @@ cmp.setup({
|
|||||||
completeopt = "menu,menuone,noselect,noinsert"
|
completeopt = "menu,menuone,noselect,noinsert"
|
||||||
},
|
},
|
||||||
formatting = {
|
formatting = {
|
||||||
format = lspkind.cmp_format({
|
format = function(entry, vim_item)
|
||||||
with_text = true,
|
vim_item.kind = string.format('%s %s', kind_icons[vim_item.kind], vim_item.kind)
|
||||||
menu = {
|
vim_item.menu = ({
|
||||||
buffer = "[buf]",
|
buffer = "[Buffer]",
|
||||||
nvim_lsp = "[LSP]",
|
nvim_lsp = "[LSP]",
|
||||||
path = "[path]"
|
luasnip = "[Snippet]",
|
||||||
}
|
nvim_lua = "[Lua]",
|
||||||
})
|
path = "[File]"
|
||||||
|
})[entry.source.name]
|
||||||
|
return vim_item
|
||||||
|
end
|
||||||
},
|
},
|
||||||
experimental = {
|
experimental = {
|
||||||
ghost_text = true
|
ghost_text = true
|
||||||
|
|||||||
Reference in New Issue
Block a user