diff --git a/.config/nvim/lua/josean/plugins/telescope.lua b/.config/nvim/lua/josean/plugins/telescope.lua index 2afd28a..d1eb304 100644 --- a/.config/nvim/lua/josean/plugins/telescope.lua +++ b/.config/nvim/lua/josean/plugins/telescope.lua @@ -10,18 +10,27 @@ return { config = function() local telescope = require("telescope") local actions = require("telescope.actions") + local transform_mod = require("telescope.actions.mt").transform_mod - -- Update the import for trouble sources - local trouble = require("trouble.sources.telescope") + local trouble = require("trouble") + local trouble_telescope = require("trouble.sources.telescope") + + -- or create your custom action + local custom_actions = transform_mod({ + open_trouble_qflist = function(prompt_bufnr) + trouble.toggle("quickfix") + end, + }) telescope.setup({ defaults = { path_display = { "smart" }, mappings = { i = { - [""] = actions.move_selection_previous, - [""] = actions.move_selection_next, - [""] = actions.send_selected_to_qflist, + [""] = actions.move_selection_previous, -- move to prev result + [""] = actions.move_selection_next, -- move to next result + [""] = actions.send_selected_to_qflist + custom_actions.open_trouble_qflist, + [""] = trouble_telescope.open, -- Use the new way to integrate with Trouble via Telescope }, }, }, @@ -29,7 +38,8 @@ return { telescope.load_extension("fzf") - local keymap = vim.keymap + -- set keymaps + local keymap = vim.keymap -- for conciseness keymap.set("n", "ff", "Telescope find_files", { desc = "Fuzzy find files in cwd" }) keymap.set("n", "fr", "Telescope oldfiles", { desc = "Fuzzy find recent files" })