58 lines
2.6 KiB
Lua
58 lines
2.6 KiB
Lua
|
return {
|
||
|
"nvim-telescope/telescope.nvim",
|
||
|
branch = "0.1.x",
|
||
|
dependencies = {
|
||
|
"nvim-lua/plenary.nvim",
|
||
|
"folke/trouble.nvim",
|
||
|
{ "nvim-telescope/telescope-fzf-native.nvim", build = "make" },
|
||
|
"nvim-tree/nvim-web-devicons",
|
||
|
"folke/todo-comments.nvim",
|
||
|
},
|
||
|
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.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 = {
|
||
|
["<C-k>"] = actions.move_selection_previous, -- move to prev result
|
||
|
["<C-j>"] = actions.move_selection_next, -- move to next result
|
||
|
["<C-q>"] = actions.send_selected_to_qflist + custom_actions.open_trouble_qflist,
|
||
|
["<C-t>"] = trouble_telescope.open,
|
||
|
},
|
||
|
},
|
||
|
},
|
||
|
})
|
||
|
|
||
|
telescope.load_extension("fzf")
|
||
|
|
||
|
-- 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>fr", "<cmd>Telescope oldfiles<cr>", { desc = "Fuzzy find recent files" })
|
||
|
keymap.set("n", "<leader>fg", "<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" })
|
||
|
keymap.set("n", "<leader>ft", "<cmd>TodoTelescope<cr>", { desc = "Find todos" })
|
||
|
keymap.set("n", "<leader>fb", "<cmd>Telescope buffers", { desc = "Find Buffers" })
|
||
|
keymap.set("n", "<leader>fh", "<cmd>Telescope help_tags", { desc = "Find Help Tags" })
|
||
|
keymap.set("n", "<leader>fs", "<cmd>Telescope lsp_document_symbols", { desc = "Find Symbols" })
|
||
|
keymap.set("n", "<leader>fi", "<cmd>AdvancedGitSearch<CR>", { desc = "AdvancedGitSearch" })
|
||
|
keymap.set("n", "<leader>fo", "<cmd>Telescope oldfiles", { desc = "Find Old Files" })
|
||
|
keymap.set("n", "<leader>fw", "<cmd>Telescope grep_string", { desc = "Find Word under Cursor" })
|
||
|
end,
|
||
|
}
|