Retained comments

This commit is contained in:
MrCee 2024-05-31 12:09:25 +00:00
parent 443d81eff2
commit 7bab2b8fb5

View file

@ -10,18 +10,27 @@ return {
config = function() config = function()
local telescope = require("telescope") local telescope = require("telescope")
local actions = require("telescope.actions") local actions = require("telescope.actions")
local transform_mod = require("telescope.actions.mt").transform_mod
-- Update the import for trouble sources local trouble = require("trouble")
local trouble = require("trouble.sources.telescope") 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({ telescope.setup({
defaults = { defaults = {
path_display = { "smart" }, path_display = { "smart" },
mappings = { mappings = {
i = { i = {
["<C-k>"] = actions.move_selection_previous, ["<C-k>"] = actions.move_selection_previous, -- move to prev result
["<C-j>"] = actions.move_selection_next, ["<C-j>"] = actions.move_selection_next, -- move to next result
["<C-q>"] = actions.send_selected_to_qflist, ["<C-q>"] = actions.send_selected_to_qflist + custom_actions.open_trouble_qflist,
["<C-t>"] = trouble_telescope.open, -- Use the new way to integrate with Trouble via Telescope
}, },
}, },
}, },
@ -29,7 +38,8 @@ return {
telescope.load_extension("fzf") telescope.load_extension("fzf")
local keymap = vim.keymap -- set keymaps
local keymap = vim.keymap -- for conciseness
keymap.set("n", "<leader>ff", "<cmd>Telescope find_files<cr>", { desc = "Fuzzy find files in cwd" }) keymap.set("n", "<leader>ff", "<cmd>Telescope find_files<cr>", { desc = "Fuzzy find files in cwd" })
keymap.set("n", "<leader>fr", "<cmd>Telescope oldfiles<cr>", { desc = "Fuzzy find recent files" }) keymap.set("n", "<leader>fr", "<cmd>Telescope oldfiles<cr>", { desc = "Fuzzy find recent files" })