feat nvim: 程式碼候選字顯示icon
This commit is contained in:
parent
4aa9f05ffa
commit
192e7cc48f
@ -47,4 +47,8 @@ return {
|
||||
{ "saadparwaiz1/cmp_luasnip" },
|
||||
|
||||
{ "rafamadriz/friendly-snippets" },
|
||||
|
||||
{ "onsails/lspkind.nvim",
|
||||
lazy = true,
|
||||
}
|
||||
}
|
||||
|
@ -5,7 +5,7 @@ cmp.setup({
|
||||
snippet = {
|
||||
-- REQUIRED - you must specify a snippet engine
|
||||
expand = function(args)
|
||||
vim.fn["vsnip#anonymous"](args.body) -- For `vsnip` users.
|
||||
-- vim.fn["vsnip#anonymous"](args.body) -- For `vsnip` users.
|
||||
require('luasnip').lsp_expand(args.body) -- For `luasnip` users.
|
||||
-- require('snippy').expand_snippet(args.body) -- For `snippy` users.
|
||||
-- vim.fn["UltiSnips#Anon"](args.body) -- For `ultisnips` users.
|
||||
@ -23,8 +23,10 @@ cmp.setup({
|
||||
-- documentation = cmp.config.window.bordered(),
|
||||
},
|
||||
mapping = cmp.mapping.preset.insert({
|
||||
['<C-b>'] = cmp.mapping.scroll_docs(-4),
|
||||
['<C-f>'] = cmp.mapping.scroll_docs(4),
|
||||
["<C-p>"] = cmp.mapping.select_prev_item(),
|
||||
["<C-n>"] = cmp.mapping.select_next_item(),
|
||||
-- ["<C-d>"] = cmp.mapping.scroll_docs(-4), --已知會衝到,先關閉
|
||||
-- ["<C-f>"] = cmp.mapping.scroll_docs(4), --已知會衝到,先關閉
|
||||
['<C-Space>'] = cmp.mapping.complete(),
|
||||
['<C-e>'] = cmp.mapping.abort(),
|
||||
['<CR>'] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
|
||||
@ -42,7 +44,16 @@ cmp.setup({
|
||||
-- { name = 'snippy' }, -- For snippy users.
|
||||
}, {
|
||||
{ name = 'buffer' },
|
||||
})
|
||||
{ name = 'path' },
|
||||
}),
|
||||
|
||||
formatting = {
|
||||
format = require("lspkind").cmp_format {
|
||||
mode = "symbol_text", -- 顯示圖示+文字
|
||||
maxwidth = 50,
|
||||
ellipsis_char = "...",
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
-- To use git you need to install the plugin petertriho/cmp-git and uncomment lines below
|
||||
|
Loading…
x
Reference in New Issue
Block a user