From 80ef7eec86b43a6075b71e6d0839d59d614d12a3 Mon Sep 17 00:00:00 2001 From: Miguel Da Silva Date: Wed, 11 Sep 2024 21:58:54 +0200 Subject: [PATCH] Add trouble plugin, change shortcuts behaviours --- lua/keymaps.lua | 2 +- lua/kickstart/plugins/trouble.lua | 47 +++++++++++++++++++++++++++++++ lua/lazy_plugins.lua | 1 + 3 files changed, 49 insertions(+), 1 deletion(-) create mode 100644 lua/kickstart/plugins/trouble.lua diff --git a/lua/keymaps.lua b/lua/keymaps.lua index cbfe0922..fdc41ae4 100644 --- a/lua/keymaps.lua +++ b/lua/keymaps.lua @@ -48,7 +48,7 @@ vim.keymap.set('v', 'K', ":m '<-2gv=gv", { desc = 'make the selected hightli vim.keymap.set('n', '', 'nohlsearch') -- Diagnostic keymaps -vim.keymap.set('n', 'q', vim.diagnostic.setloclist, { desc = 'Open diagnostic [Q]uickfix list' }) +-- vim.keymap.set('n', 'q', vim.diagnostic.setloclist, { desc = 'Open diagnostic [Q]uickfix list' }) -- Exit terminal mode in the builtin terminal with a shortcut that is a bit easier -- for people to discover. Otherwise, you normally need to press , which diff --git a/lua/kickstart/plugins/trouble.lua b/lua/kickstart/plugins/trouble.lua new file mode 100644 index 00000000..8b5def5a --- /dev/null +++ b/lua/kickstart/plugins/trouble.lua @@ -0,0 +1,47 @@ +return { + 'folke/trouble.nvim', + dependencies = { 'nvim-tree/nvim-web-devicons' }, + opts = {}, + -- config = function() + -- -- local actions = require("telescope.actions") + -- local trouble = require("trouble.sources.telescope") + -- + -- local telescope = require("telescope") + -- + -- telescope.setup({ + -- defaults = { + -- mappings = { + -- i = { [""] = trouble.open }, + -- n = { [""] = trouble.open }, + -- }, + -- }, + -- }) + -- vim.keymap.set( + -- "n", + -- "td", + -- function() require("trouble").toggle("document_diagnostics") end + -- ) + -- vim.keymap.set( + -- "n", + -- "tq", + -- function() require("trouble").toggle("quickfix") end + -- ) + -- vim.keymap.set( + -- "n", + -- "tl", + -- function() require("trouble").toggle("loclist") end + -- ) + -- vim.keymap.set( + -- "n", + -- "gR", + -- function() require("trouble").toggle("lsp_references") end + -- ) + -- end, + keys = { + { + 'q', + 'Trouble diagnostics toggle filter.buf=0', + desc = 'Diagnostics (Trouble)', + }, + }, +} diff --git a/lua/lazy_plugins.lua b/lua/lazy_plugins.lua index 32c8eb3c..6e49c3b9 100644 --- a/lua/lazy_plugins.lua +++ b/lua/lazy_plugins.lua @@ -19,6 +19,7 @@ require('lazy').setup({ require 'kickstart.plugins.harpoon', require 'kickstart.plugins.todo_comments', require 'kickstart.plugins.comments', + require 'kickstart.plugins.trouble', require 'kickstart.plugins.gitsigns', -- adds gitsigns recommend keymaps -- require 'kickstart.plugins.debug',