Add lspkind for nvim-cmp icons
This commit is contained in:
parent
d1ad784b27
commit
f6484a1c78
|
|
@ -5,13 +5,22 @@
|
|||
"auto-session": { "branch": "main", "commit": "8c282a5faccfd2f8c9ed8a81e280ef405555bc62" },
|
||||
"blame.nvim": { "branch": "main", "commit": "cfc4385d979c7e21a5c7e237c391be0948c5ee95" },
|
||||
"bookmarks.nvim": { "branch": "main", "commit": "67610c62c8bb9b7799afd8a307b8727143bc097b" },
|
||||
"cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },
|
||||
"cmp-nvim-lsp": { "branch": "main", "commit": "39e2eda76828d88b773cc27a3f61d2ad782c922d" },
|
||||
"cmp-nvim-lsp-signature-help": { "branch": "main", "commit": "031e6ba70b0ad5eee49fd2120ff7a2e325b17fa7" },
|
||||
"cmp-nvim-lua": { "branch": "main", "commit": "f12408bdb54c39c23e67cab726264c10db33ada8" },
|
||||
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
|
||||
"cmp-vsnip": { "branch": "main", "commit": "989a8a73c44e926199bfd05fa7a516d51f2d2752" },
|
||||
"cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" },
|
||||
"conform.nvim": { "branch": "master", "commit": "62eba813b7501b39612146cbf29cd07f1d4ac29c" },
|
||||
"copilot.lua": { "branch": "master", "commit": "86537b286f18783f8b67bccd78a4ef4345679625" },
|
||||
"dashboard-nvim": { "branch": "master", "commit": "fabf5feec96185817c732d47d363f34034212685" },
|
||||
"detect-language.nvim": { "branch": "main", "commit": "670b2d78deb01b268ee8675c66b9f5256054109a" },
|
||||
"diffview.nvim": { "branch": "main", "commit": "4516612fe98ff56ae0415a259ff6361a89419b0a" },
|
||||
"distant.nvim": { "branch": "v0.3", "commit": "823267cf3b77cf9a7ae28454926eabc18fec1ba0" },
|
||||
"dressing.nvim": { "branch": "master", "commit": "c5775a888adbc50652cb370073fcfec963eca93e" },
|
||||
"easy-commands.nvim": { "branch": "main", "commit": "e1a4721d9d9805ed7115a4083b8095acf7a721fe" },
|
||||
"faster.nvim": { "branch": "main", "commit": "e85c5bdff0cd1e17cbee855ae23c25e7b8e597cb" },
|
||||
"flatten.nvim": { "branch": "main", "commit": "e420e531d2ab24aebcf7b3c9fca28e6c5c34964d" },
|
||||
"git-messenger.vim": { "branch": "master", "commit": "1ec2daa0722982a329887708f52a40497ceb86be" },
|
||||
"gitsigns.nvim": { "branch": "main", "commit": "80214a857ce512cc64964abddc1d8eb5a3e28396" },
|
||||
|
|
@ -25,10 +34,14 @@
|
|||
"hop.nvim": { "branch": "master", "commit": "8f51ef02700bb3cdcce94e92eff16170a6343c4f" },
|
||||
"hurl.nvim": { "branch": "main", "commit": "c02e58be1e3941c1ee06c8cf15affaf3f740a26e" },
|
||||
"img-clip.nvim": { "branch": "main", "commit": "28a32d811d69042f4fa5c3d5fa35571df2bc1623" },
|
||||
"inc-rename.nvim": { "branch": "main", "commit": "8ba77017ca468f3029bf88ef409c2d20476ea66b" },
|
||||
"indent-blankline.nvim": { "branch": "master", "commit": "db926997af951da38e5004ec7b9fbdc480b48f5d" },
|
||||
"lazy.nvim": { "branch": "main", "commit": "077102c5bfc578693f12377846d427f49bc50076" },
|
||||
"lspkind.nvim": { "branch": "master", "commit": "cff4ae321a91ee3473a92ea1a8c637e3a9510aec" },
|
||||
"lspsaga.nvim": { "branch": "main", "commit": "4ce44df854f447cf0a8972e5387b3aeb5efc798b" },
|
||||
"lua-async-await": { "branch": "main", "commit": "652d94df34e97abe2d4a689edbc4270e7ead1a98" },
|
||||
"lualine.nvim": { "branch": "master", "commit": "b431d228b7bbcdaea818bdc3e25b8cdbe861f056" },
|
||||
"mason-lspconfig.nvim": { "branch": "main", "commit": "482350b050bd413931c2cdd4857443c3da7d57cb" },
|
||||
"mason.nvim": { "branch": "main", "commit": "e2f7f9044ec30067bc11800a9e266664b88cda22" },
|
||||
"maximize.nvim": { "branch": "master", "commit": "d688b66344b03ee6e5a32a0a40af85d174490af8" },
|
||||
"mdeval.nvim": { "branch": "master", "commit": "2c32e2f3e7d8f222e7a4724989f218d036e1081d" },
|
||||
|
|
@ -41,6 +54,7 @@
|
|||
"nightfox.nvim": { "branch": "main", "commit": "d3e8b1acc095baf57af81bb5e89fe7c4359eb619" },
|
||||
"noice.nvim": { "branch": "main", "commit": "448bb9c524a7601035449210838e374a30153172" },
|
||||
"nui.nvim": { "branch": "main", "commit": "61574ce6e60c815b0a0c4b5655b8486ba58089a1" },
|
||||
"nvim-cmp": { "branch": "main", "commit": "ae644feb7b67bf1ce4260c231d1d4300b19c6f30" },
|
||||
"nvim-colorizer.lua": { "branch": "master", "commit": "a065833f35a3a7cc3ef137ac88b5381da2ba302e" },
|
||||
"nvim-dap": { "branch": "master", "commit": "281a2e4cd1e7a17cea7ecb1745d84a8ab1249925" },
|
||||
"nvim-java": { "branch": "main", "commit": "b3174e41ab51867123d8663eced53b33f1548522" },
|
||||
|
|
@ -49,6 +63,7 @@
|
|||
"nvim-java-refactor": { "branch": "main", "commit": "ea1420fed5463c9cc976c2b4175f434b3646f0f7" },
|
||||
"nvim-java-test": { "branch": "main", "commit": "7f0f40e9c5b7eab5096d8bec6ac04251c6e81468" },
|
||||
"nvim-lint": { "branch": "master", "commit": "debabca63c0905b59ce596a55a8e33eafdf66342" },
|
||||
"nvim-listchars": { "branch": "main", "commit": "40b05e8375af11253434376154a9e6b3e9400747" },
|
||||
"nvim-lspconfig": { "branch": "master", "commit": "8a3610d29df83d8632f8ee7c3afc779c12725531" },
|
||||
"nvim-notify": { "branch": "master", "commit": "d333b6f167900f6d9d42a59005d82919830626bf" },
|
||||
"nvim-recorder": { "branch": "main", "commit": "ce96792c1ff750977fc3affc56f0561b0c20a7e2" },
|
||||
|
|
@ -76,7 +91,6 @@
|
|||
"snipe.nvim": { "branch": "main", "commit": "f1abd4aaaef6398b45dcddc9f1a40dd982f732b0" },
|
||||
"sniprun": { "branch": "master", "commit": "a29d7b1c313b00980015ad79fa0ab512a0729940" },
|
||||
"spring-boot.nvim": { "branch": "main", "commit": "218c0c26c14d99feca778e4d13f5ec3e8b1b60f0" },
|
||||
"sqlite.lua": { "branch": "master", "commit": "d0ffd703b56d090d213b497ed4eb840495f14a11" },
|
||||
"telescope-file-browser.nvim": { "branch": "master", "commit": "a46780830b576049c675680650f773bedfa8677a" },
|
||||
"telescope-tabs": { "branch": "master", "commit": "0a678eefcb71ebe5cb0876aa71dd2e2583d27fd3" },
|
||||
"telescope-undo.nvim": { "branch": "main", "commit": "51be9ae7c42fc27c0b05505e3a0162e0f05fbb6a" },
|
||||
|
|
@ -87,7 +101,7 @@
|
|||
"trouble.nvim": { "branch": "main", "commit": "6efc446226679fda0547c0fd6a7892fd5f5b15d8" },
|
||||
"vim-illuminate": { "branch": "master", "commit": "5eeb7951fc630682c322e88a9bbdae5c224ff0aa" },
|
||||
"vim-visual-multi": { "branch": "master", "commit": "38b0e8d94a5499ccc17d6159763d32c79f53417b" },
|
||||
"vim-vsnip": { "branch": "master", "commit": "02a8e79295c9733434aab4e0e2b8c4b7cea9f3a9" },
|
||||
"which-key.nvim": { "branch": "main", "commit": "6c1584eb76b55629702716995cca4ae2798a9cca" },
|
||||
"yankbank-nvim": { "branch": "main", "commit": "e93fd66c24450c0e7697b47b82271a78ae89b5d8" },
|
||||
"yeet.nvim": { "branch": "master", "commit": "928a7526bfe72baf52806c40e6c6a57a60132d9d" }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,11 +2,12 @@
|
|||
-- menuone: show popup even when there is only one suggestion
|
||||
-- noinsert: Only insert text when selection is confirmed
|
||||
-- noselect: force us to select one from the suggestions
|
||||
vim.opt.completeopt = {'menuone', 'noselect', 'noinsert', 'preview'}
|
||||
vim.opt.completeopt = { 'menuone', 'noselect', 'noinsert', 'preview' }
|
||||
-- shortmess is used to avoid excessive messages
|
||||
vim.opt.shortmess = vim.opt.shortmess + { c = true }
|
||||
|
||||
local cmp = require('cmp')
|
||||
local lspkind = require('lspkind')
|
||||
cmp.setup({
|
||||
enabled = true,
|
||||
preselect = cmp.PreselectMode.None,
|
||||
|
|
@ -15,6 +16,22 @@ cmp.setup({
|
|||
require('luasnip').lsp_expand(args.body) -- For `luasnip` users.
|
||||
end,
|
||||
},
|
||||
formatting = {
|
||||
format = lspkind.cmp_format({
|
||||
mode = 'symbol', -- show only symbol annotations
|
||||
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
|
||||
})
|
||||
},
|
||||
mapping = {
|
||||
-- Shift+TAB to go to the Previous Suggested item
|
||||
['<Up>'] = cmp.mapping.select_prev_item(),
|
||||
|
|
@ -39,12 +56,12 @@ cmp.setup({
|
|||
},
|
||||
|
||||
-- sources are the installed sources that can be used for code suggestions
|
||||
sources = {
|
||||
{ name = 'path' },
|
||||
{ name = 'nvim_lsp', keyword_length = 3 },
|
||||
{ name = 'nvim_lsp_signature_help'},
|
||||
{ name = 'nvim_lua', keyword_length = 2},
|
||||
{ name = 'buffer', keyword_length = 2 },
|
||||
{ name = 'vsnip', keyword_length = 2 },
|
||||
}
|
||||
sources = {
|
||||
{ name = 'path' },
|
||||
{ name = 'nvim_lsp', keyword_length = 3 },
|
||||
{ name = 'nvim_lsp_signature_help' },
|
||||
{ name = 'nvim_lua', keyword_length = 2 },
|
||||
{ name = 'buffer', keyword_length = 2 },
|
||||
{ name = 'vsnip', keyword_length = 2 },
|
||||
}
|
||||
})
|
||||
|
|
|
|||
|
|
@ -24,9 +24,9 @@ require("noice").setup {
|
|||
-- NOTE: If you enable messages, then the cmdline is enabled automatically.
|
||||
-- This is a current Neovim limitation.
|
||||
enabled = true, -- enables the Noice messages UI
|
||||
view = "notify", -- default view for messages
|
||||
view = "mini", -- default view for messages
|
||||
view_error = "notify", -- view for errors
|
||||
view_warn = "notify", -- view for warnings
|
||||
view_warn = "mini", -- view for warnings
|
||||
view_history = "messages", -- view for :messages
|
||||
view_search = "virtualtext", -- view for search count messages. Set to `false` to disable
|
||||
},
|
||||
|
|
|
|||
|
|
@ -0,0 +1,12 @@
|
|||
return {
|
||||
--TODO: Move the treesitter
|
||||
{
|
||||
'spywhere/detect-language.nvim',
|
||||
config = function()
|
||||
require('detect-language').setup()
|
||||
end
|
||||
},
|
||||
{
|
||||
'pteroctopus/faster.nvim'
|
||||
}
|
||||
}
|
||||
|
|
@ -42,6 +42,7 @@ return {
|
|||
end,
|
||||
},
|
||||
'hrsh7th/nvim-cmp',
|
||||
'onsails/lspkind.nvim',
|
||||
'hrsh7th/cmp-nvim-lsp',
|
||||
'hrsh7th/cmp-nvim-lua',
|
||||
'hrsh7th/cmp-nvim-lsp-signature-help',
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
local lsp_plugins = require 'plugin.lsp-plugins'
|
||||
local ui_plugins = require 'plugin.ui-plugins'
|
||||
local editor_plugins = require 'plugin.editor-plugins'
|
||||
|
||||
return {
|
||||
-- Themes
|
||||
|
|
@ -10,6 +11,7 @@ return {
|
|||
},
|
||||
lsp_plugins,
|
||||
ui_plugins,
|
||||
editor_plugins,
|
||||
{
|
||||
'nvim-pack/nvim-spectre'
|
||||
},
|
||||
|
|
|
|||
Loading…
Reference in New Issue