2023-08-24 19:39:11 +02:00
|
|
|
return {
|
|
|
|
"nvim-telescope/telescope.nvim",
|
|
|
|
branch = "0.1.x",
|
|
|
|
dependencies = {
|
|
|
|
"nvim-lua/plenary.nvim",
|
|
|
|
{ "nvim-telescope/telescope-fzf-native.nvim", build = "make" },
|
|
|
|
"nvim-tree/nvim-web-devicons",
|
2024-04-03 17:08:26 +02:00
|
|
|
"folke/todo-comments.nvim",
|
2023-08-24 19:39:11 +02:00
|
|
|
},
|
|
|
|
config = function()
|
|
|
|
local telescope = require("telescope")
|
|
|
|
local actions = require("telescope.actions")
|
2024-04-03 17:31:43 +02:00
|
|
|
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,
|
|
|
|
})
|
2022-10-17 20:40:36 +02:00
|
|
|
|
2023-08-24 19:39:11 +02:00
|
|
|
telescope.setup({
|
|
|
|
defaults = {
|
2024-04-03 17:08:26 +02:00
|
|
|
path_display = { "smart" },
|
2023-08-24 19:39:11 +02:00
|
|
|
mappings = {
|
|
|
|
i = {
|
|
|
|
["<C-k>"] = actions.move_selection_previous, -- move to prev result
|
|
|
|
["<C-j>"] = actions.move_selection_next, -- move to next result
|
2024-04-03 17:31:43 +02:00
|
|
|
["<C-q>"] = actions.send_selected_to_qflist + custom_actions.open_trouble_qflist,
|
|
|
|
["<C-t>"] = trouble_telescope.smart_open_with_trouble,
|
2023-08-24 19:39:11 +02:00
|
|
|
},
|
|
|
|
},
|
2022-11-05 22:13:18 +01:00
|
|
|
},
|
2023-08-24 19:39:11 +02:00
|
|
|
})
|
|
|
|
|
|
|
|
telescope.load_extension("fzf")
|
|
|
|
|
|
|
|
-- set keymaps
|
|
|
|
local keymap = vim.keymap -- for conciseness
|
2022-10-17 20:40:36 +02:00
|
|
|
|
2023-09-02 03:40:47 +02:00
|
|
|
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>fs", "<cmd>Telescope live_grep<cr>", { desc = "Find string in cwd" })
|
|
|
|
keymap.set("n", "<leader>fc", "<cmd>Telescope grep_string<cr>", { desc = "Find string under cursor in cwd" })
|
2024-04-03 17:08:26 +02:00
|
|
|
keymap.set("n", "<leader>ft", "<cmd>TodoTelescope<cr>", { desc = "Find todos" })
|
2023-08-24 19:39:11 +02:00
|
|
|
end,
|
|
|
|
}
|