local telescope = require("telescope") local builtin = require("telescope.builtin") local actions = require("telescope.actions") local utils = require("telescope.utils") telescope.setup({ defaults = { mappings = { n = { q = actions.close, [""] = actions.close, [""] = actions.select_default, [""] = actions.results_scrolling_up, [""] = actions.results_scrolling_down, }, }, file_ignore_patterns = { "^%.git/", }, layout_config = { height = 30, width = 80, scroll_speed = 3, }, }, extensions = { undo = { mappings = { i = { [""] = require("telescope-undo.actions").yank_deletions, [""] = false, [""] = false, [""] = require("telescope-undo.actions").yank_additions, }, n = { ["u"] = false, }, }, }, }, pickers = { oldfiles = { initial_mode = "normal", }, buffers = { initial_mode = "normal", mappings = { n = { [""] = actions.delete_buffer, }, }, }, live_grep = { layout_config = { width = 160, preview_width = 80, }, }, highlights = { layout_config = { width = 160, preview_width = 80, }, }, diagnostics = { initial_mode = "normal", layout_config = { width = 160, preview_width = 80, }, }, lsp_definitions = { initial_mode = "normal", layout_config = { width = 160, preview_width = 80, }, }, lsp_type_definitions = { initial_mode = "normal", }, lsp_implementations = { initial_mode = "normal", }, lsp_references = { initial_mode = "normal", layout_config = { width = 160, preview_width = 80, }, }, git_status = { initial_mode = "normal", }, }, }) vim.keymap.set("n", "ff", function() builtin.find_files({ hidden = true, no_ignore = true, no_ignore_parent = true, previewer = false, }) end) vim.keymap.set("n", "fr", function() builtin.oldfiles({ only_cwd = true, hidden = true, previewer = false, }) end) vim.keymap.set("n", "fg", function() builtin.live_grep({ additional_args = function(_) return { "--hidden", "--iglob=!.venv", "--iglob=!vendor", "--iglob=!.git", } end, previewer = true, }) end) vim.keymap.set("n", "fG", function() builtin.live_grep({ additional_args = function(_) return { "--hidden", "--iglob=!.venv", "--iglob=!vendor", "--iglob=!.git", } end, cwd = utils.buffer_dir(), previewer = true, }) end) vim.keymap.set("n", "fb", function() builtin.buffers({ previewer = false, sort_mru = true }) end) vim.keymap.set("n", "fd", function() builtin.diagnostics({ bufnr = 0, }) end) vim.keymap.set("n", "dl", builtin.diagnostics) vim.keymap.set("n", "grt", builtin.lsp_type_definitions) vim.keymap.set("n", "gd", builtin.lsp_definitions) vim.keymap.set("n", "gri", builtin.lsp_implementations) vim.keymap.set("n", "grr", builtin.lsp_references) telescope.load_extension("fzf") telescope.load_extension("notify") vim.keymap.set("n", "fn", function() telescope.extensions.notify.notify({ initial_mode = "normal", layout_config = { width = 160, preview_width = 80, }, }) end) telescope.load_extension("undo") vim.keymap.set("n", "fu", function() telescope.extensions.undo.undo({ initial_mode = "normal", layout_config = { width = 160, preview_width = 80, }, }) end)