From f2bad8563e4c6538d3fd342f5374deaa516b5d95 Mon Sep 17 00:00:00 2001 From: Thomas Ruoff Date: Tue, 24 Sep 2024 22:24:05 +0200 Subject: [PATCH 1/4] preinstall typescript lsp --- lua/plugins/lsp.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/lua/plugins/lsp.lua b/lua/plugins/lsp.lua index a4cb5e4..33c296a 100644 --- a/lua/plugins/lsp.lua +++ b/lua/plugins/lsp.lua @@ -99,6 +99,7 @@ return { 'lua_ls', 'eslint_d', 'prettier', + 'ts_ls', } vim.list_extend(ensure_installed, servers_to_install) From 94b7ac4b03a5212d200bb209231009995f456f16 Mon Sep 17 00:00:00 2001 From: Thomas Ruoff Date: Wed, 2 Oct 2024 07:56:17 +0200 Subject: [PATCH 2/4] fix lspkind in all places --- lua/plugins/cmp.lua | 28 +++++++++++++++++++--------- lua/plugins/lsp.lua | 11 ++++++++++- 2 files changed, 29 insertions(+), 10 deletions(-) diff --git a/lua/plugins/cmp.lua b/lua/plugins/cmp.lua index b6444f5..863d468 100644 --- a/lua/plugins/cmp.lua +++ b/lua/plugins/cmp.lua @@ -17,16 +17,9 @@ return { vim.opt.completeopt = { 'menu', 'menuone', 'noselect' } vim.opt.shortmess:append 'c' - local lspkind = require 'lspkind' - lspkind.init { - symbol_map = { - Copilot = '', - }, - mode = 'symbol', - } - vim.api.nvim_set_hl(0, 'CmpItemKindCopilot', { fg = '#6CC644' }) - local cmp = require 'cmp' + local lspkind = require 'lspkind' + lspkind.init() cmp.setup { sources = { @@ -54,6 +47,23 @@ return { require('luasnip').lsp_expand(args.body) end, }, + + formatting = { + expandable_indicator = true, + fields = { 'abbr', 'kind' }, + format = lspkind.cmp_format { + mode = 'symbol', -- show only symbol annotations + maxwidth = 20, -- prevent the popup from showing more than provided characters (e.g 50 will not show more than 50 characters) + 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, + }, + }, } -- Setup up vim-dadbod diff --git a/lua/plugins/lsp.lua b/lua/plugins/lsp.lua index 33c296a..503fee5 100644 --- a/lua/plugins/lsp.lua +++ b/lua/plugins/lsp.lua @@ -191,6 +191,15 @@ return { }) end, }, + { + 'onsails/lspkind-nvim', + opts = { + -- defines how annotations are shown + -- default: symbol + -- options: 'text', 'text_symbol', 'symbol_text', 'symbol' + mode = 'symbol_text', + }, + }, { 'hedyhli/outline.nvim', lazy = true, @@ -199,7 +208,7 @@ return { { 'co', 'Outline', desc = 'Toggle outline' }, }, opts = { - -- Your setup opts here + symbols = { icon_source = 'lspkind' }, }, }, } From 38d67529598db14369d6048a83b3a7e7c4e25fbf Mon Sep 17 00:00:00 2001 From: Thomas Ruoff Date: Wed, 2 Oct 2024 07:56:42 +0200 Subject: [PATCH 3/4] use opts for noice --- lua/plugins/oil.lua | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/lua/plugins/oil.lua b/lua/plugins/oil.lua index 9c6e126..c7c1424 100644 --- a/lua/plugins/oil.lua +++ b/lua/plugins/oil.lua @@ -2,19 +2,18 @@ return { { 'stevearc/oil.nvim', dependencies = { 'nvim-tree/nvim-web-devicons' }, - config = function() - require('oil').setup { - columns = { 'icon' }, - keymaps = { - [''] = false, - [''] = 'actions.select_split', - ['q'] = 'actions.close', - }, - view_options = { - show_hidden = true, - }, - } - + opts = { + columns = { 'icon' }, + keymaps = { + [''] = false, + [''] = 'actions.select_split', + ['q'] = 'actions.close', + }, + view_options = { + show_hidden = true, + }, + }, + init = function() -- Open parent directory in current window vim.keymap.set('n', '-', 'Oil', { desc = 'Open parent directory' }) From a5011df745e099740b3391c92c98b24db36cc4e6 Mon Sep 17 00:00:00 2001 From: Thomas Ruoff Date: Wed, 2 Oct 2024 07:56:57 +0200 Subject: [PATCH 4/4] add mapping to dismiss --- lua/plugins/noice.lua | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lua/plugins/noice.lua b/lua/plugins/noice.lua index 0f355c4..1a0f9ec 100644 --- a/lua/plugins/noice.lua +++ b/lua/plugins/noice.lua @@ -23,6 +23,14 @@ return { lsp_doc_border = true, -- add a border to hover docs and signature help }, }, + keys = { + { 'md', 'Noice dismiss', mode = 'n', desc = 'Noice dismiss' }, + }, + init = function() + vim.keymap.set('c', '', function() + require('noice').redirect(vim.fn.getcmdline()) + end, { desc = 'Redirect Cmdline' }) + end, dependencies = { 'MunifTanjim/nui.nvim', 'rcarriga/nvim-notify',