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.
This commit is contained in:
David Ibia
2024-01-14 04:01:28 +01:00
parent 4273043666
commit adc0e7d95c

View File

@@ -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 = {
["<C-t>"] = trouble_telescope.open_with_trouble,
["<C-q>"] = actions.send_to_qflist,
},
n = {
["<C-t>"] = trouble_telescope.open_with_trouble,
["<C-q>"] = actions.send_to_qflist,
},
},
},
})
-- Keybindings
local opts = { noremap = true, silent = true }
opts.desc = "Trouble: Open Document Diagnostics"
vim.keymap.set("n", "<leader>td", "<cmd>TroubleToggle document_diagnostics<CR>", opts)
opts.desc = "Trouble: Open Workspace Diagnostics"
vim.keymap.set("n", "<leader>tw", "<cmd>TroubleToggle workspace_diagnostics<CR>", opts)
opts.desc = "Trouble: Open Quickfix List"
vim.keymap.set("n", "<leader>tq", "<cmd>TroubleToggle quickfix<CR>", opts)