質問内容
以下のコードなのですが 参考サイトのlspkind-nvimのコードをPackerを使ってインストールして利用しています。
githubサイトのようにアイコンを表示させたいのですが表示されませんこれはなぜでしょうか?
知りたいこと
補完ウインドウでアイコンを表示させたい
試した事
nerd font をインストール
提示コードの(See [#30](https://github.com/onsails/lspkind-nvim/pull/30))
を見ましたがnvimのバージョンが古く参考になりません。
補完ウインドウは表示されているためプラグインは有効です。
mode = 'symbol_text',--preset = 'codicons',preset = 'default',
等の位置を変えたりしましたが表示されません
参考サイト
nerd font https://www.nerdfonts.com/#home
github: https://github.com/onsails/lspkind.nvim
reddit: https://www.reddit.com/r/neovim/comments/15z8pk9/lspkind_doesnt_do_anything/
提示コード --- コメント部参照
lua
1local M = {} 2M.setup = function() 3 4local lspconfig = require('lspconfig') 5local cmp_nvim_lsp = require('cmp_nvim_lsp') 6local lspkind = require('lspkind') 7local cmp = require("cmp") 8local types = require("cmp.types") 9local str = require("cmp.utils.str") 10local lsp = require("lspconfig") 11lspkind.init({}) 12 13-- Lspkindのrequire 14--補完関係の設定 15lspconfig.clangd.setup{ 16 capabilities = require('cmp_nvim_lsp').default_capabilities(vim.lsp.protocol.make_client_capabilities()), 17 18 -- 補完の設定 19 init_options = { 20 clangdFileStatus = true, 21 usePlaceholders = true, 22 completeUnimported = true, 23 semanticHighlighting = true, 24 }, 25 26 -- ドキュメント表示の設定 27 handlers = { 28 ["textDocument/hover"] = function(_, result, ctx) 29 if result and result.contents then 30 vim.lsp.util.hover_or_preview(opts, result.contents, ctx.bufnr, ctx.winid, ctx.range.start, ctx.range["end"]) 31 end 32 end, 33 }, 34} 35 36cmp.setup({ 37 snippet = { 38 expand = function(args) 39 vim.fn["UltiSnips#Anon"](args.body) 40 end, 41 }, 42 sources = { 43 { name = "nvim_lsp" }, 44 { name = "UltiSnips" }, 45 { name = "buffer" }, 46 { name = "path" }, 47 }, 48 mapping = cmp.mapping.preset.insert({ 49 ["<C-p>"] = cmp.mapping.select_prev_item(), --Ctrl+pで補完欄を一つ上に移動 50 ["<C-n>"] = cmp.mapping.select_next_item(), --Ctrl+nで補完欄を一つ下に移動 51 ['<C-l>'] = cmp.mapping.complete(), 52 ['<C-e>'] = cmp.mapping.abort(), 53 ["<C-y>"] = cmp.mapping.confirm({ select = true }),--Ctrl+yで補完を選択確定 54 }), 55 experimental = { 56 ghost_text = false, 57 }, 58 59 60 -- 補完の設定 61 init_options = { 62 clangdFileStatus = true, 63 usePlaceholders = true, 64 completeUnimported = true, 65 semanticHighlighting = true, 66 }, 67 68 -- ドキュメント表示の設定 69 handlers = { 70 ["textDocument/hover"] = function(_, result, ctx) 71 if result and result.contents then 72 vim.lsp.util.hover_or_preview(opts, result.contents, ctx.bufnr, ctx.winid, ctx.range.start, ctx.range["end"]) 73 end 74 end, 75 }, 76mode = 'symbol_text', 77--preset = 'codicons', 78preset = 'default', 79 -- Lspkind(アイコン)を設定 80 formatting = { 81---------------------------------------------------------------------------------- 82 format = require('lspkind').cmp_format({ 83 -- The function below will be called before any actual modifications from lspkind 84 -- so that you can provide more controls on popup customization. (See [#30](https://github.com/onsails/lspkind-nvim/pull/30)) 85 mode = 'symbol', -- show only symbol annotations 86 maxwidth = 50, -- prevent the popup from showing more than provided characters (e.g 50 will not show more than 50 characters) 87 ellipsis_char = "...", -- when popup menu exceed maxwidth, the truncated part would show ellipsis_char instead (must define maxwidth first) 88----------------------------------------------------------------------------------- 89 90 91 }) 92 } 93 --- capabilities = cmp_nvim_lsp.default_capabilities() 94}) 95 96 97cmp.setup.cmdline('/', { 98 mapping = cmp.mapping.preset.cmdline(), 99 sources = { 100 { name = 'buffer' } --ソース類を設定 101 } 102}) 103cmp.setup.cmdline(":", { 104 mapping = cmp.mapping.preset.cmdline(), 105 sources = { 106 { name = "path" }, --ソース類を設定 107 }, 108}) 109 110vim.opt.completeopt = "menu,menuone,noselect" 111end 112 113return M

バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2023/12/23 02:28
2023/12/23 03:46
2023/12/23 04:11
2023/12/23 09:15