summaryrefslogtreecommitdiffstats
path: root/.config/nvim/lua/plugins/lspkind.lua
diff options
context:
space:
mode:
authorjoe <rbo@gmx.us>2025-08-25 18:13:21 +0200
committerjoe <rbo@gmx.us>2025-08-25 18:13:21 +0200
commit41682275d321b6b79ee4c07f25e819875519466e (patch)
tree301ee0175c17d2394a950ef7d11bffd0d47597ac /.config/nvim/lua/plugins/lspkind.lua
parentup (diff)
downloaddotfiles-bsd-41682275d321b6b79ee4c07f25e819875519466e.tar.gz
dotfiles-bsd-41682275d321b6b79ee4c07f25e819875519466e.tar.bz2
dotfiles-bsd-41682275d321b6b79ee4c07f25e819875519466e.tar.xz
dotfiles-bsd-41682275d321b6b79ee4c07f25e819875519466e.tar.zst
dotfiles-bsd-41682275d321b6b79ee4c07f25e819875519466e.zip
cool
Diffstat (limited to '.config/nvim/lua/plugins/lspkind.lua')
-rw-r--r--.config/nvim/lua/plugins/lspkind.lua102
1 files changed, 102 insertions, 0 deletions
diff --git a/.config/nvim/lua/plugins/lspkind.lua b/.config/nvim/lua/plugins/lspkind.lua
new file mode 100644
index 0000000..b1fc6d1
--- /dev/null
+++ b/.config/nvim/lua/plugins/lspkind.lua
@@ -0,0 +1,102 @@
+return {
+ {
+ 'onsails/lspkind.nvim',
+ config = function()
+ require('lspkind').setup({
+ mode = 'symbol_text',
+ preset = 'codicons',
+ symbol_map = {
+ 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 = "",
+ },
+ })
+ end
+ },
+ {
+ "hrsh7th/nvim-cmp",
+ dependencies = {
+ "onsails/lspkind.nvim",
+ "hrsh7th/cmp-nvim-lsp",
+ "hrsh7th/cmp-buffer",
+ "hrsh7th/cmp-path",
+ "L3MON4D3/LuaSnip",
+ },
+ event = "InsertEnter",
+ config = function()
+ local cmp = require('cmp')
+ local lspkind = require('lspkind')
+
+ cmp.setup({
+ snippet = {
+ expand = function(args)
+ require('luasnip').lsp_expand(args.body)
+ end,
+ },
+ formatting = {
+ format = lspkind.cmp_format({
+ mode = 'symbol_text',
+ maxwidth = {
+ menu = 50,
+ abbr = 50,
+ },
+ ellipsis_char = '...',
+ show_labelDetails = true,
+ before = function(entry, vim_item)
+ -- Add source name to menu
+ vim_item.menu = ({
+ nvim_lsp = "[LSP]",
+ luasnip = "[LuaSnip]",
+ buffer = "[Buffer]",
+ path = "[Path]",
+ })[entry.source.name]
+ return vim_item
+ end
+ })
+ },
+ mapping = cmp.mapping.preset.insert({
+ ['<C-j>'] = cmp.mapping.select_next_item(cmp_select),
+ ['<C-k>'] = cmp.mapping.select_prev_item(cmp_select),
+ ['<C-b>'] = 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 }),
+ }),
+ sources = cmp.config.sources({
+ { name = 'nvim_lsp' },
+ { name = 'luasnip' },
+ }, {
+ { name = 'buffer' },
+ { name = 'path' },
+ }),
+ window = {
+ completion = cmp.config.window.bordered(),
+ documentation = cmp.config.window.bordered(),
+ },
+ })
+ end,
+ },
+}