diff --git a/lua/plugins/telescope.lua b/lua/plugins/telescope.lua new file mode 100644 index 0000000..9a60c4e --- /dev/null +++ b/lua/plugins/telescope.lua @@ -0,0 +1,147 @@ +--[[ + +⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣠⣴⣾⣷⣦⣄⡀ +⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣠⣴⣾⣿⣿⣿⣿⣿⣿⣿⣿⣷⣦⣄⡀ +⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣠⣴⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣦⣄⡀ +⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡀⠚⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠗⢀ +⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣀⣤⣄⡉⠓⠦⣌⡙⠻⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠟⢋⣡⠴⠚⢉⣠⣤⣀ +⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣤⣶⣿⣿⣿⣿⣿⣷⣦⣄⡉⠓⠦⣌⡙⠻⢿⣿⣿⣿⣿⣿⣿⡿⠟⢋⣡⠴⠚⢉⣠⣴⣾⣿⣿⣿⣿⣿⣶⣤ +⠀⠀⠀⠀⠀⠀⠀⠀⠐⣦⣄⡉⠛⠿⣿⣿⣿⣿⣿⣿⣿⣷⣦⣄⡉⠓⠦⣌⡙⠻⠟⢋⣡⠴⠚⢉⣠⣴⣾⣿⣿⣿⣿⣿⣿⣿⠿⠛⢉⣠⣴⠂ +⠀⠀⠀⠀⢀⣠⣴⣆⡈⠻⢿⣿⣷⣦⣄⡉⠛⠿⣿⣿⣿⣿⣿⣿⣿⣷⣦⣄⡉⠃⠘⢉⣠⣴⣾⣿⣿⣿⣿⣿⣿⣿⠿⠛⢉⣠⣴⣾⣿⡿⠟⢁⣰⣦⣄⡀ +⠀⠀⠐⠾⣿⣿⣿⣿⣿⣷⣦⣌⡙⠻⢿⣿⣷⣦⣄⡉⠛⠿⣿⣿⣿⣿⣿⣿⣿⣷⣾⣿⣿⣿⣿⣿⣿⣿⠿⠛⢉⣠⣴⣾⣿⡿⠟⢋⣡⣴⣾⣿⣿⣿⣿⣿⠷⠂ +⠀⢸⣷⣦⣄⡉⠛⠿⣿⣿⣿⣿⣿⣷⣦⣌⡙⠻⢿⣿⣷⣦⣄⡉⠛⠿⣿⣿⣿⣿⣿⣿⣿⣿⠿⠛⢉⣠⣴⣾⣿⡿⠟⢋⣡⣴⣾⣿⣿⣿⣿⣿⠿⠛⢉⣠⣴⣾⡇ +⠀⢸⣿⣿⣿⣿⣷⣦⣄⡉⠛⠿⣿⣿⣿⣿⣿⣷⣦⣌⡙⠻⢿⣿⣷⣦⣄⡉⠛⠿⠿⠛⢉⣠⣴⣾⣿⡿⠟⢋⣡⣴⣾⣿⣿⣿⣿⣿⠿⠛⢉⣠⣴⣾⣿⣿⣿⣿⡇ +⠀⠀⠉⠛⠿⣿⣿⣿⣿⣿⣷⣦⣄⡉⠛⠿⣿⣿⣿⣿⣿⣷⣦⣌⡙⠻⢿⣿⣷⡆⢰⣾⣿⡿⠟⢋⣡⣴⣾⣿⣿⣿⣿⣿⠿⠛⢉⣠⣴⣾⣿⣿⣿⣿⣿⠿⠛⠉ +⠀⠀⠀⠀⠀⠀⠉⠛⠿⣿⣿⣿⣿⣿⣷⣦⣄⡉⠛⠿⣿⣿⣿⣿⣿⣷⣦⣌⡙⠃⠘⢋⣡⣴⣾⣿⣿⣿⣿⣿⠿⠛⢉⣠⣴⣾⣿⣿⣿⣿⣿⠿⠛⠉ +⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠛⠿⣿⣿⣿⣿⣿⣷⣦⣄⡉⠛⠿⣿⣿⣿⣿⣿⣷⣾⣿⣿⣿⣿⣿⠿⠛⢉⣠⣴⣾⣿⣿⣿⣿⣿⠿⠛⠉ +⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠛⠿⣿⣿⣿⣿⣿⣷⣦⣄⡉⠛⠿⣿⣿⣿⣿⠿⠛⢉⣠⣴⣾⣿⣿⣿⣿⣿⠿⠛⠉ +⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠛⠿⣿⣿⣿⣿⣿⣷⣦⣄⡉⢉⣠⣴⣾⣿⣿⣿⣿⣿⠿⠛⠉ +⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠛⠿⣿⣿⣿⣿⡇⢸⣿⣿⣿⣿⠿⠛⠉ +⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠛⠿⡇⢸⠿⠛⠉ + + __ _ _ + / _|___ ___| |_ __ _ ___| | __ + | ||_ /____/ __| __/ _` |/ __| |/ / + | _/ /_____\__ \ || (_| | (__| < + |_|/___| |___/\__\__,_|\___|_|\_\ + + Neovim 0.12 configuration + (c) Frnk Zechert 2026 +]] + +return { + { + "nvim-telescope/telescope.nvim", + version = "*", + dependencies = { + { "nvim-lua/plenary.nvim" }, + { "nvim-telescope/telescope-fzf-native.nvim", build = "make" }, + { "nvim-telescope/telescope-ui-select.nvim" }, + }, + opts = { + defaults = { + mappings = { + i = { + [""] = "which_key", + } + } + }, + pickers = { + }, + extensions = { + fzf = { + fuzzy = true, + override_generic_sorter = true, + override_file_sorter = true, + case_mode = "smart_case", + } + }, + }, + config = function(_, opts) + local telescope = require("telescope") + local builtin = require("telescope.builtin") + local actions = require("telescope.actions") + local config = require("telescope.config") + + -- find in hidden files and folders, but never inside the .git folder + local vimgrep_args = { unpack(config.values.vimgrep_arguments) } + table.insert(vimgrep_args, "--hidden") + table.insert(vimgrep_args, "--glob") + table.insert(vimgrep_args, "!**/.git/*") + + opts = vim.tbl_deep_extend("force", opts, { + defaults = { + vimgrep_arguments = vimgrep_args, + }, + pickers = { + buffers = { + mappings = { + i = { + [""] = actions.delete_buffer + actions.move_to_top + } + } + } + }, + extensions = { + ["ui-select"] = { + require("telescope.themes").get_cursor({}) + } + } + }) + telescope.setup(opts) + telescope.load_extension("ui-select") + telescope.load_extension("fzf") + + local function is_git_repo() + vim.fn.system("git rev-parse --is-inside-work-tree") + return vim.v.shell_error == 0 + end + + local function get_git_root() + local dot_git_path = vim.fn.finddir(".git", ".;") + return vim.fn.fnamemodify(dot_git_path, ":h") + end + + local function live_grep_in_project(opts) + local opts = opts or {} + if is_git_repo() then + opts.cwd = get_git_root() + end + builtin.live_grep(opts) + end + + local function find_in_project(opts) + local opts = opts or {} + if is_git_repo() then + opts.cwd = get_git_root() + end + builtin.find_files(opts) + end + + -- Pickers + vim.keymap.set("n", "ff", find_in_project, { desc = "Find Files in Project" }) + vim.keymap.set("n", "fs", live_grep_in_project, { desc = "Live Grep in Project" }) + vim.keymap.set("n", "fS", function() + live_grep_in_project({grep_open_files = true, prompt_title = "Live Grep in Open Files"}) + end, { desc = "Live Grep in Open Files" }) + vim.keymap.set({"n", "v"}, "fw", builtin.grep_string, { desc = "Find Word" }) + vim.keymap.set("n", "fb", builtin.buffers, { desc = "Find Buffers" }) + vim.keymap.set("n", "fr", builtin.oldfiles, { desc = "Find Recent Files" }) + vim.keymap.set("n", "fh", builtin.help_tags, { desc = "Find Help" }) + vim.keymap.set("n", "fq", builtin.quickfix, { desc = "Quickfix" }) + vim.keymap.set("n", "fQ", builtin.quickfixhistory, { desc = "Quickfix History" }) + vim.keymap.set("n", "ft", builtin.filetypes, { desc = "Show Filetypes" }) + vim.keymap.set("n", "fH", builtin.quickfixhistory, { desc = "Find Highlights" }) + vim.keymap.set("n", "fc", builtin.quickfixhistory, { desc = "Find Resume" }) + vim.keymap.set("n", "fd", builtin.diagnostics, { desc = "Find Diagnostics" }) + vim.keymap.set("n", "fC", builtin.commands, { desc = "Find Commands" }) + vim.keymap.set("n", "f+", builtin.builtin, { desc = "All Pickers" }) + -- Git Pickers + vim.keymap.set("n", "fgc", builtin.git_commits, { desc = "Git Commits" }) + vim.keymap.set("n", "fgC", builtin.git_bcommits, { desc = "Git Buffer Commits" }) + vim.keymap.set("n", "fgb", builtin.git_branches, { desc = "Git Branches" }) + vim.keymap.set("n", "fgs", builtin.git_status, { desc = "Git Status" }) + vim.keymap.set("n", "fgS", builtin.git_stash, { desc = "Git Stash" }) + end + } +} diff --git a/lua/plugins/whichkey.lua b/lua/plugins/whichkey.lua index c2722ff..821ef02 100644 --- a/lua/plugins/whichkey.lua +++ b/lua/plugins/whichkey.lua @@ -41,6 +41,8 @@ return { preset = "modern", spec = { { "b", group = "Buffers" }, + { "f", group = "Find (Telescope)" }, + { "fg", group = "Git (Telescope)" }, }, }, keys = { diff --git a/packages.txt b/packages.txt index 921d230..813921a 100644 --- a/packages.txt +++ b/packages.txt @@ -1,2 +1,5 @@ git tree-sitter-cli +fzf +ripgrep +fd