From 02e53ab522abe6b3fd4d66d4488f54e4fcdf56ca Mon Sep 17 00:00:00 2001 From: Marcelo Jacobus Date: Sun, 29 Jun 2025 21:53:12 -0300 Subject: [PATCH] Bring telescope finders back --- lua/plugins/telescope.lua | 75 ++++++++++++++++++++++++++++++++++----- 1 file changed, 66 insertions(+), 9 deletions(-) diff --git a/lua/plugins/telescope.lua b/lua/plugins/telescope.lua index 3057a63..9b54abe 100644 --- a/lua/plugins/telescope.lua +++ b/lua/plugins/telescope.lua @@ -1,5 +1,5 @@ -- lua/plugins/telescope.lua --- https://www.lazyvim.org/extras/editor/telescope + local function searchBranchFiles() local results = require("mj.utils").branch_files() local pickers = require("telescope.pickers") @@ -18,22 +18,79 @@ local function searchBranchFiles() }) :find() end + return { { "nvim-telescope/telescope.nvim", - opts = function(_, opts) - vim.keymap.set("n", "", function() + dependencies = { + "nvim-lua/plenary.nvim", + "nvim-tree/nvim-web-devicons", + }, + cmd = "Telescope", + keys = { + -- Files + { "ff", "Telescope find_files", desc = "Find Files" }, + { "fr", "Telescope oldfiles", desc = "Recent Files" }, + { "", function() local project_root = require("project_nvim.project").get_project_root() or vim.fn.getcwd() require("telescope.builtin").find_files({ cwd = project_root, -- Force project root }) - end, { desc = "Find Files (Project Root)" }) + end, desc = "Find Files (Project Root)" }, - vim.keymap.set("n", "sg", function() + -- Search + -- { "sg", "Telescope live_grep", desc = "Grep" }, + { "sw", "Telescope grep_string", desc = "Word" }, + { "sb", "Telescope current_buffer_fuzzy_find", desc = "Buffer" }, + { "sd", "Telescope diagnostics", desc = "Diagnostics" }, + { "sh", "Telescope help_tags", desc = "Help Pages" }, + { "sk", "Telescope keymaps", desc = "Key Maps" }, + { "sR", "Telescope resume", desc = "Resume" }, + + -- Git + { "gc", "Telescope git_commits", desc = "commits" }, + { "gs", "Telescope git_status", desc = "status" }, + { "gb", "Telescope git_branches", desc = "branches" }, + { "h", searchBranchFiles, desc = "Branch Files" }, + + -- LSP + { "ls", "Telescope lsp_document_symbols", desc = "Document Symbols" }, + { "lS", "Telescope lsp_dynamic_workspace_symbols", desc = "Workspace Symbols" }, + { "lr", "Telescope lsp_references", desc = "References" }, + { "li", "Telescope lsp_implementations", desc = "Implementations" }, + { "ld", "Telescope lsp_definitions", desc = "Definitions" }, + { "lt", "Telescope lsp_type_definitions", desc = "Type Definitions" }, + + -- Commands + { ":", "Telescope command_history", desc = "Command History" }, + { "sc", "Telescope commands", desc = "Commands" }, + + -- Custom + { "sg", function() require("mj.telescope.grep_with_args").setup() - end, { desc = "Custom Live Grep With args" }) - - vim.keymap.set("n", "h", searchBranchFiles, { desc = "Telescope find branch files" }) - end, + end, desc = "Custom Live Grep With args" }, + }, + opts = { + defaults = { + prompt_prefix = " ", + selection_caret = " ", + mappings = { + i = { + [""] = function(...) + require("telescope.actions").move_selection_next(...) + end, + [""] = function(...) + require("telescope.actions").move_selection_previous(...) + end, + [""] = function(...) + require("telescope.actions").cycle_history_next(...) + end, + [""] = function(...) + require("telescope.actions").cycle_history_prev(...) + end, + }, + }, + }, + }, }, }