Updated trouble.nvim setup to v3

This commit is contained in:
josean-dev 2024-07-08 11:39:15 -04:00
parent 2c12f439f4
commit 6614ff76b7
2 changed files with 11 additions and 8 deletions

View file

@ -13,7 +13,7 @@ return {
local transform_mod = require("telescope.actions.mt").transform_mod local transform_mod = require("telescope.actions.mt").transform_mod
local trouble = require("trouble") local trouble = require("trouble")
local trouble_telescope = require("trouble.providers.telescope") local trouble_telescope = require("trouble.sources.telescope")
-- or create your custom action -- or create your custom action
local custom_actions = transform_mod({ local custom_actions = transform_mod({
@ -30,7 +30,7 @@ return {
["<C-k>"] = actions.move_selection_previous, -- move to prev result ["<C-k>"] = actions.move_selection_previous, -- move to prev result
["<C-j>"] = actions.move_selection_next, -- move to next result ["<C-j>"] = actions.move_selection_next, -- move to next result
["<C-q>"] = actions.send_selected_to_qflist + custom_actions.open_trouble_qflist, ["<C-q>"] = actions.send_selected_to_qflist + custom_actions.open_trouble_qflist,
["<C-t>"] = trouble_telescope.smart_open_with_trouble, ["<C-t>"] = trouble_telescope.open,
}, },
}, },
}, },

View file

@ -1,12 +1,15 @@
return { return {
"folke/trouble.nvim", "folke/trouble.nvim",
dependencies = { "nvim-tree/nvim-web-devicons", "folke/todo-comments.nvim" }, dependencies = { "nvim-tree/nvim-web-devicons", "folke/todo-comments.nvim" },
opts = {
focus = true,
},
cmd = "Trouble",
keys = { keys = {
{ "<leader>xx", "<cmd>TroubleToggle<CR>", desc = "Open/close trouble list" }, { "<leader>xw", "<cmd>Trouble diagnostics toggle<CR>", desc = "Open trouble workspace diagnostics" },
{ "<leader>xw", "<cmd>TroubleToggle workspace_diagnostics<CR>", desc = "Open trouble workspace diagnostics" }, { "<leader>xd", "<cmd>Trouble diagnostics toggle filter.buf=0<CR>", desc = "Open trouble document diagnostics" },
{ "<leader>xd", "<cmd>TroubleToggle document_diagnostics<CR>", desc = "Open trouble document diagnostics" }, { "<leader>xq", "<cmd>Trouble quickfix toggle<CR>", desc = "Open trouble quickfix list" },
{ "<leader>xq", "<cmd>TroubleToggle quickfix<CR>", desc = "Open trouble quickfix list" }, { "<leader>xl", "<cmd>Trouble loclist toggle<CR>", desc = "Open trouble location list" },
{ "<leader>xl", "<cmd>TroubleToggle loclist<CR>", desc = "Open trouble location list" }, { "<leader>xt", "<cmd>Trouble todo toggle<CR>", desc = "Open todos in trouble" },
{ "<leader>xt", "<cmd>TodoTrouble<CR>", desc = "Open todos in trouble" },
}, },
} }