document new lspkind integration with nvim-cmp (#275)
This commit is contained in:
18
README.md
18
README.md
@@ -366,11 +366,8 @@ Please see [FAQ](#how-to-show-name-of-item-kind-and-source-like-compe) if you wo
|
|||||||
local lspkind = require('lspkind')
|
local lspkind = require('lspkind')
|
||||||
cmp.setup {
|
cmp.setup {
|
||||||
formatting = {
|
formatting = {
|
||||||
format = function(entry, vim_item)
|
format = lspkind.cmp_format(),
|
||||||
vim_item.kind = lspkind.presets.default[vim_item.kind]
|
},
|
||||||
return vim_item
|
|
||||||
end
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -515,20 +512,13 @@ This will greatly slow down nvim-cmp (and other LSP related features).
|
|||||||
|
|
||||||
```lua
|
```lua
|
||||||
formatting = {
|
formatting = {
|
||||||
format = function(entry, vim_item)
|
format = require("lspkind").cmp_format({with_text = true, menu = ({
|
||||||
-- fancy icons and a name of kind
|
|
||||||
vim_item.kind = require("lspkind").presets.default[vim_item.kind] .. " " .. vim_item.kind
|
|
||||||
|
|
||||||
-- set a name for each source
|
|
||||||
vim_item.menu = ({
|
|
||||||
buffer = "[Buffer]",
|
buffer = "[Buffer]",
|
||||||
nvim_lsp = "[LSP]",
|
nvim_lsp = "[LSP]",
|
||||||
luasnip = "[LuaSnip]",
|
luasnip = "[LuaSnip]",
|
||||||
nvim_lua = "[Lua]",
|
nvim_lua = "[Lua]",
|
||||||
latex_symbols = "[Latex]",
|
latex_symbols = "[Latex]",
|
||||||
})[entry.source.name]
|
})}),
|
||||||
return vim_item
|
|
||||||
end,
|
|
||||||
},
|
},
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user