From b2876885b98d553e4a2718ba730a9e504c5dde05 Mon Sep 17 00:00:00 2001 From: josean-dev Date: Wed, 3 Apr 2024 11:31:43 -0400 Subject: [PATCH] Added keymaps to telescope to open items as well as selected quick fix list in trouble --- .config/nvim/lua/josean/plugins/telescope.lua | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/.config/nvim/lua/josean/plugins/telescope.lua b/.config/nvim/lua/josean/plugins/telescope.lua index 8970bcd..9664a37 100644 --- a/.config/nvim/lua/josean/plugins/telescope.lua +++ b/.config/nvim/lua/josean/plugins/telescope.lua @@ -10,6 +10,17 @@ return { config = function() local telescope = require("telescope") local actions = require("telescope.actions") + local transform_mod = require("telescope.actions.mt").transform_mod + + local trouble = require("trouble") + local trouble_telescope = require("trouble.providers.telescope") + + -- or create your custom action + local custom_actions = transform_mod({ + open_trouble_qflist = function(prompt_bufnr) + trouble.toggle("quickfix") + end, + }) telescope.setup({ defaults = { @@ -18,7 +29,8 @@ return { i = { [""] = actions.move_selection_previous, -- move to prev result [""] = actions.move_selection_next, -- move to next result - [""] = actions.send_selected_to_qflist + actions.open_qflist, + [""] = actions.send_selected_to_qflist + custom_actions.open_trouble_qflist, + [""] = trouble_telescope.smart_open_with_trouble, }, }, },