style cmp window
This commit is contained in:
parent
857a4f16b7
commit
939e4ae8e8
|
@ -37,9 +37,11 @@ return { -- Autocompletion
|
|||
-- into multiple repos for maintenance purposes.
|
||||
"hrsh7th/cmp-nvim-lsp",
|
||||
"hrsh7th/cmp-path",
|
||||
"onsails/lspkind.nvim",
|
||||
},
|
||||
config = function()
|
||||
-- See `:help cmp`
|
||||
local lspkind = require("lspkind")
|
||||
local cmp = require("cmp")
|
||||
local luasnip = require("luasnip")
|
||||
luasnip.config.setup({})
|
||||
|
@ -115,6 +117,40 @@ return { -- Autocompletion
|
|||
{ name = "luasnip" },
|
||||
{ name = "path" },
|
||||
},
|
||||
|
||||
formatting = {
|
||||
fields = { "kind", "abbr", "menu" },
|
||||
expandable_indicator = true,
|
||||
format = lspkind.cmp_format({
|
||||
mode = "symbol_text", -- show only symbol annotations
|
||||
menu = {
|
||||
buffer = "[Buffer]",
|
||||
nvim_lsp = "[LSP]",
|
||||
luasnip = "[LuaSnip]",
|
||||
nvim_lua = "[Lua]",
|
||||
latex_symbols = "[Latex]",
|
||||
},
|
||||
maxwidth = 50, -- prevent the popup from showing more than provided characters (e.g 50 will not show more than 50 characters)
|
||||
-- can also be a function to dynamically calculate max width such as
|
||||
-- maxwidth = function() return math.floor(0.45 * vim.o.columns) end,
|
||||
ellipsis_char = "...", -- when popup menu exceed maxwidth, the truncated part would show ellipsis_char instead (must define maxwidth first)
|
||||
show_labelDetails = true, -- show labelDetails in menu. Disabled by default
|
||||
-- The function below will be called before any actual modifications from lspkind
|
||||
-- so that you can provide more controls on popup customization. (See [#30](https://github.com/onsails/lspkind-nvim/pull/30))
|
||||
before = function(entry, vim_item)
|
||||
return vim_item
|
||||
end,
|
||||
}),
|
||||
},
|
||||
window = {
|
||||
completion = cmp.config.window.bordered({
|
||||
col_offset = -3,
|
||||
side_padding = 1,
|
||||
}),
|
||||
documentation = cmp.config.window.bordered({
|
||||
winhighlight = "Normal:CursorLine",
|
||||
}),
|
||||
},
|
||||
})
|
||||
end,
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue