From adc0e7d95ca56071829637870b7bd082d0692088 Mon Sep 17 00:00:00 2001 From: David Ibia Date: Sun, 14 Jan 2024 04:01:28 +0100 Subject: [PATCH] feat(trouble.lua): add configuration for telescope plugin to integrate with trouble plugin The `trouble.lua` file is added to configure the integration between the `telescope` plugin and the `trouble` plugin. This configuration sets up key mappings for opening trouble windows and quickfix lists. It also adds keybindings for toggling document diagnostics, workspace diagnostics, and the quickfix list using the leader key. This configuration enhances the functionality of the `telescope` plugin by integrating it with the `trouble` plugin. --- lua/absolute/after/trouble.lua | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 lua/absolute/after/trouble.lua diff --git a/lua/absolute/after/trouble.lua b/lua/absolute/after/trouble.lua new file mode 100644 index 0000000..d3ce36a --- /dev/null +++ b/lua/absolute/after/trouble.lua @@ -0,0 +1,30 @@ +local telescope = require("telescope") +local actions = require("telescope.actions") +local trouble_telescope = require("trouble.providers.telescope") + +telescope.setup({ + defaults = { + mappings = { + i = { + [""] = trouble_telescope.open_with_trouble, + [""] = actions.send_to_qflist, + }, + n = { + [""] = trouble_telescope.open_with_trouble, + [""] = actions.send_to_qflist, + }, + }, + }, +}) + +-- Keybindings +local opts = { noremap = true, silent = true } + +opts.desc = "Trouble: Open Document Diagnostics" +vim.keymap.set("n", "td", "TroubleToggle document_diagnostics", opts) + +opts.desc = "Trouble: Open Workspace Diagnostics" +vim.keymap.set("n", "tw", "TroubleToggle workspace_diagnostics", opts) + +opts.desc = "Trouble: Open Quickfix List" +vim.keymap.set("n", "tq", "TroubleToggle quickfix", opts)