From 2262349daf32f606e1fa66a36c97576082e0a0e3 Mon Sep 17 00:00:00 2001 From: Dietrich Moerman Date: Wed, 11 Oct 2023 20:27:19 +0200 Subject: [PATCH] Use `+` for LSP document highlight and clear on cursor move --- nvim/.config/nvim/lua/dietrichm/lsp.lua | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/nvim/.config/nvim/lua/dietrichm/lsp.lua b/nvim/.config/nvim/lua/dietrichm/lsp.lua index a6f60961..15a2b932 100644 --- a/nvim/.config/nvim/lua/dietrichm/lsp.lua +++ b/nvim/.config/nvim/lua/dietrichm/lsp.lua @@ -16,10 +16,17 @@ local on_attach = function(_, bufnr) map('i', '', vim.lsp.buf.signature_help) map('n', 'rn', vim.lsp.buf.rename) map('n', 'lf', vim.lsp.buf.format) + map('n', '+', vim.lsp.buf.document_highlight) -- Avoid jumping text when (diagnostic) signs are (un)set. vim.opt_local.signcolumn = 'yes' + vim.api.nvim_create_autocmd('CursorMoved', { + group = 'vimrc', + buffer = bufnr, + callback = vim.lsp.buf.clear_references, + }) + vim.api.nvim_buf_create_user_command( bufnr, 'LspSwitch',