commit d0cb0cd888fbb0c8e627ddb92f316a1c9dfc2c47
parent 3e5d22d7bbd9e8383aaeb9c0a97a9ef215d83984
Author: Chris Bracken <chris@bracken.jp>
Date: Sat, 31 Aug 2024 10:48:06 -0700
vim: eliminate lsp-kind plugin
All it does is replace textual completion kinds with nerdfont icons and
truncate completions to some maximum length. Instead, just write the
truncation function myself.
Diffstat:
3 files changed, 11 insertions(+), 12 deletions(-)
diff --git a/.config/nvim/lazy-lock.json b/.config/nvim/lazy-lock.json
@@ -8,7 +8,6 @@
"gitsigns.nvim": { "branch": "main", "commit": "899e993850084ea33d001ec229d237bc020c19ae" },
"gn": { "branch": "main", "commit": "225e90c5025bf74f41dbee60d9cde4512c846fe7" },
"lazy.nvim": { "branch": "main", "commit": "48b52b5cfcf8f88ed0aff8fde573a5cc20b1306d" },
- "lspkind.nvim": { "branch": "master", "commit": "cff4ae321a91ee3473a92ea1a8c637e3a9510aec" },
"nvim-cmp": { "branch": "main", "commit": "ae644feb7b67bf1ce4260c231d1d4300b19c6f30" },
"nvim-lspconfig": { "branch": "master", "commit": "3ad562700d0615818bf358268ac8914f6ce2b079" },
"rust.vim": { "branch": "master", "commit": "889b9a7515db477f4cb6808bef1769e53493c578" },
diff --git a/.config/nvim/lua/config/keymaps.lua b/.config/nvim/lua/config/keymaps.lua
@@ -30,12 +30,10 @@ vim.keymap.set('n', '<leader>fr', '<cmd>FzfLua lsp_references<CR>')
vim.keymap.set('n', '<leader>fs', '<cmd>FzfLua lsp_document_symbols<CR>')
-- Toggle diagnostics.
-vim.keymap.set('n', '<leader>d', function()
+vim.keymap.set('n', '<leader>dq', vim.diagnostic.setloclist, opts)
+vim.keymap.set('n', '<leader>dd', function()
vim.diagnostic.enable(not vim.diagnostic.is_enabled())
end, { silent = true })
-vim.keymap.set('n', '<leader>ww', vim.diagnostic.setloclist, opts)
-vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, opts)
-vim.keymap.set('n', ']d', vim.diagnostic.goto_next, opts)
-- Key mapping to toggle absolute/relative numbering.
vim.keymap.set('n', '<leader>n', function()
diff --git a/.config/nvim/lua/plugins/languages.lua b/.config/nvim/lua/plugins/languages.lua
@@ -11,7 +11,6 @@ return {
opts = {},
event = "InsertEnter",
config = function()
- local lspkind = require("lspkind")
local cmp = require("cmp")
cmp.setup({
completion = {
@@ -35,18 +34,21 @@ return {
{ name = "path" },
}),
formatting = {
- format = lspkind.cmp_format({
- maxwidth = 60,
- elipsis_char = "...",
- }),
- },
+ format = function(entry, vim_item)
+ -- Truncate completions to some maximum length.
+ local max_width = 60
+ if vim.fn.strchars(vim_item.abbr) > max_width then
+ vim_item.abbr = vim.fn.strcharpart(vim_item.abbr, 0, max_width) .. "…"
+ end
+ return vim_item
+ end
+ }
})
end,
dependencies = {
"hrsh7th/cmp-buffer",
"hrsh7th/cmp-nvim-lsp",
"hrsh7th/cmp-path",
- "onsails/lspkind.nvim",
},
},
{ "nathangrigg/vim-beancount" },