From 66cf16d9f9124b5f6790565b2b98ead97e501595 Mon Sep 17 00:00:00 2001 From: Jack Jamison Date: Tue, 8 Jul 2025 19:11:27 -0400 Subject: xdg and plugins --- .config/nvim/lua/options.lua | 3 +++ .config/nvim/lua/plugins/glance.lua | 10 +++++++++ .config/nvim/lua/plugins/lspconfig.lua | 19 ++++++++++++++++- .config/nvim/lua/plugins/signature.lua | 10 +++++++++ .config/nvim/lua/plugins/trouble.lua | 37 ++++++++++++++++++++++++++++++++++ 5 files changed, 78 insertions(+), 1 deletion(-) create mode 100644 .config/nvim/lua/plugins/glance.lua create mode 100644 .config/nvim/lua/plugins/signature.lua create mode 100644 .config/nvim/lua/plugins/trouble.lua (limited to '.config/nvim/lua') diff --git a/.config/nvim/lua/options.lua b/.config/nvim/lua/options.lua index 2010277..9a5901c 100644 --- a/.config/nvim/lua/options.lua +++ b/.config/nvim/lua/options.lua @@ -32,3 +32,6 @@ vim.opt.swapfile = false vim.opt.backup = false vim.opt.undodir = os.getenv("HOME") .. "/.cache/nvim/undodir" vim.opt.undofile = true + +-- misc +vim.opt.updatetime = 700 diff --git a/.config/nvim/lua/plugins/glance.lua b/.config/nvim/lua/plugins/glance.lua new file mode 100644 index 0000000..9c43939 --- /dev/null +++ b/.config/nvim/lua/plugins/glance.lua @@ -0,0 +1,10 @@ +return { + 'dnlhc/glance.nvim', + cmd = 'Glance', + config = function() + require("glance").setup({}) + end, + keys = { + { 'gr', 'Glance references' } + } +} diff --git a/.config/nvim/lua/plugins/lspconfig.lua b/.config/nvim/lua/plugins/lspconfig.lua index 2fcfa9b..86194b1 100644 --- a/.config/nvim/lua/plugins/lspconfig.lua +++ b/.config/nvim/lua/plugins/lspconfig.lua @@ -8,7 +8,7 @@ local on_attach = function(client, bufnr) keymap('n', 'gD', vim.lsp.buf.declaration, { desc = 'Go to declaration' }) keymap('n', 'gI', vim.lsp.buf.implementation, { desc = 'Go to implementation' }) keymap('n', 'gy', vim.lsp.buf.type_definition, { desc = 'Go to type definition' }) - keymap('n', 'gr', vim.lsp.buf.references, { desc = 'List references' }) + -- keymap('n', 'gr', vim.lsp.buf.references, { desc = 'List references' }) keymap('n', 'ds', vim.lsp.buf.document_symbol, { desc = 'List document symbols' }) keymap('n', 'ws', vim.lsp.buf.workspace_symbol, { desc = 'List workspace symbols' }) @@ -74,5 +74,22 @@ return { end, } end + + -- Autohighlight symbol under cursor + vim.api.nvim_create_autocmd({ "CursorHold", "CursorHoldI" }, { + callback = function() + local bufnr = vim.api.nvim_get_current_buf() + if next(vim.lsp.get_clients({ buffer = bufnr })) then + vim.lsp.buf.document_highlight() + end + end, + }) + -- Clear highlights when cursor moves + vim.api.nvim_create_autocmd({ "CursorMoved", "CursorMovedI" }, { + callback = function() + vim.lsp.buf.clear_references() + end, + }) + end } diff --git a/.config/nvim/lua/plugins/signature.lua b/.config/nvim/lua/plugins/signature.lua new file mode 100644 index 0000000..0d0a174 --- /dev/null +++ b/.config/nvim/lua/plugins/signature.lua @@ -0,0 +1,10 @@ +return { + "ray-x/lsp_signature.nvim", + event = "InsertEnter", + opts = { + bind = true, + handler_opts = { + border = "rounded" + } + }, +} diff --git a/.config/nvim/lua/plugins/trouble.lua b/.config/nvim/lua/plugins/trouble.lua new file mode 100644 index 0000000..3741f30 --- /dev/null +++ b/.config/nvim/lua/plugins/trouble.lua @@ -0,0 +1,37 @@ +return { + "folke/trouble.nvim", + opts = {}, -- for default options, refer to the configuration section for custom setup. + cmd = "Trouble", + keys = { + { + "xx", + "Trouble diagnostics toggle", + desc = "Diagnostics (Trouble)", + }, + { + "xX", + "Trouble diagnostics toggle filter.buf=0", + desc = "Buffer Diagnostics (Trouble)", + }, + { + "cs", + "Trouble symbols toggle focus=false", + desc = "Symbols (Trouble)", + }, + { + "cl", + "Trouble lsp toggle focus=false win.position=right", + desc = "LSP Definitions / references / ... (Trouble)", + }, + { + "xL", + "Trouble loclist toggle", + desc = "Location List (Trouble)", + }, + { + "xQ", + "Trouble qflist toggle", + desc = "Quickfix List (Trouble)", + }, + }, +} -- cgit v1.2.3