148 lines
6.8 KiB
Lua
148 lines
6.8 KiB
Lua
--[[
|
||
|
||
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣠⣴⣾⣷⣦⣄⡀
|
||
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣠⣴⣾⣿⣿⣿⣿⣿⣿⣿⣿⣷⣦⣄⡀
|
||
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣠⣴⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣦⣄⡀
|
||
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡀⠚⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠗⢀
|
||
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣀⣤⣄⡉⠓⠦⣌⡙⠻⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠟⢋⣡⠴⠚⢉⣠⣤⣀
|
||
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣤⣶⣿⣿⣿⣿⣿⣷⣦⣄⡉⠓⠦⣌⡙⠻⢿⣿⣿⣿⣿⣿⣿⡿⠟⢋⣡⠴⠚⢉⣠⣴⣾⣿⣿⣿⣿⣿⣶⣤
|
||
⠀⠀⠀⠀⠀⠀⠀⠀⠐⣦⣄⡉⠛⠿⣿⣿⣿⣿⣿⣿⣿⣷⣦⣄⡉⠓⠦⣌⡙⠻⠟⢋⣡⠴⠚⢉⣠⣴⣾⣿⣿⣿⣿⣿⣿⣿⠿⠛⢉⣠⣴⠂
|
||
⠀⠀⠀⠀⢀⣠⣴⣆⡈⠻⢿⣿⣷⣦⣄⡉⠛⠿⣿⣿⣿⣿⣿⣿⣿⣷⣦⣄⡉⠃⠘⢉⣠⣴⣾⣿⣿⣿⣿⣿⣿⣿⠿⠛⢉⣠⣴⣾⣿⡿⠟⢁⣰⣦⣄⡀
|
||
⠀⠀⠐⠾⣿⣿⣿⣿⣿⣷⣦⣌⡙⠻⢿⣿⣷⣦⣄⡉⠛⠿⣿⣿⣿⣿⣿⣿⣿⣷⣾⣿⣿⣿⣿⣿⣿⣿⠿⠛⢉⣠⣴⣾⣿⡿⠟⢋⣡⣴⣾⣿⣿⣿⣿⣿⠷⠂
|
||
⠀⢸⣷⣦⣄⡉⠛⠿⣿⣿⣿⣿⣿⣷⣦⣌⡙⠻⢿⣿⣷⣦⣄⡉⠛⠿⣿⣿⣿⣿⣿⣿⣿⣿⠿⠛⢉⣠⣴⣾⣿⡿⠟⢋⣡⣴⣾⣿⣿⣿⣿⣿⠿⠛⢉⣠⣴⣾⡇
|
||
⠀⢸⣿⣿⣿⣿⣷⣦⣄⡉⠛⠿⣿⣿⣿⣿⣿⣷⣦⣌⡙⠻⢿⣿⣷⣦⣄⡉⠛⠿⠿⠛⢉⣠⣴⣾⣿⡿⠟⢋⣡⣴⣾⣿⣿⣿⣿⣿⠿⠛⢉⣠⣴⣾⣿⣿⣿⣿⡇
|
||
⠀⠀⠉⠛⠿⣿⣿⣿⣿⣿⣷⣦⣄⡉⠛⠿⣿⣿⣿⣿⣿⣷⣦⣌⡙⠻⢿⣿⣷⡆⢰⣾⣿⡿⠟⢋⣡⣴⣾⣿⣿⣿⣿⣿⠿⠛⢉⣠⣴⣾⣿⣿⣿⣿⣿⠿⠛⠉
|
||
⠀⠀⠀⠀⠀⠀⠉⠛⠿⣿⣿⣿⣿⣿⣷⣦⣄⡉⠛⠿⣿⣿⣿⣿⣿⣷⣦⣌⡙⠃⠘⢋⣡⣴⣾⣿⣿⣿⣿⣿⠿⠛⢉⣠⣴⣾⣿⣿⣿⣿⣿⠿⠛⠉
|
||
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠛⠿⣿⣿⣿⣿⣿⣷⣦⣄⡉⠛⠿⣿⣿⣿⣿⣿⣷⣾⣿⣿⣿⣿⣿⠿⠛⢉⣠⣴⣾⣿⣿⣿⣿⣿⠿⠛⠉
|
||
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠛⠿⣿⣿⣿⣿⣿⣷⣦⣄⡉⠛⠿⣿⣿⣿⣿⠿⠛⢉⣠⣴⣾⣿⣿⣿⣿⣿⠿⠛⠉
|
||
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠛⠿⣿⣿⣿⣿⣿⣷⣦⣄⡉⢉⣠⣴⣾⣿⣿⣿⣿⣿⠿⠛⠉
|
||
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠛⠿⣿⣿⣿⣿⡇⢸⣿⣿⣿⣿⠿⠛⠉
|
||
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠛⠿⡇⢸⠿⠛⠉
|
||
|
||
__ _ _
|
||
/ _|___ ___| |_ __ _ ___| | __
|
||
| ||_ /____/ __| __/ _` |/ __| |/ /
|
||
| _/ /_____\__ \ || (_| | (__| <
|
||
|_|/___| |___/\__\__,_|\___|_|\_\
|
||
|
||
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 = {
|
||
["<C-h>"] = "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 = {
|
||
["<C-d>"] = 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", "<leader>ff", find_in_project, { desc = "Find Files in Project" })
|
||
vim.keymap.set("n", "<leader>fs", live_grep_in_project, { desc = "Live Grep in Project" })
|
||
vim.keymap.set("n", "<leader>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"}, "<leader>fw", builtin.grep_string, { desc = "Find Word" })
|
||
vim.keymap.set("n", "<leader>fb", builtin.buffers, { desc = "Find Buffers" })
|
||
vim.keymap.set("n", "<leader>fr", builtin.oldfiles, { desc = "Find Recent Files" })
|
||
vim.keymap.set("n", "<leader>fh", builtin.help_tags, { desc = "Find Help" })
|
||
vim.keymap.set("n", "<leader>fq", builtin.quickfix, { desc = "Quickfix" })
|
||
vim.keymap.set("n", "<leader>fQ", builtin.quickfixhistory, { desc = "Quickfix History" })
|
||
vim.keymap.set("n", "<leader>ft", builtin.filetypes, { desc = "Show Filetypes" })
|
||
vim.keymap.set("n", "<leader>fH", builtin.quickfixhistory, { desc = "Find Highlights" })
|
||
vim.keymap.set("n", "<leader>fc", builtin.quickfixhistory, { desc = "Find Resume" })
|
||
vim.keymap.set("n", "<leader>fd", builtin.diagnostics, { desc = "Find Diagnostics" })
|
||
vim.keymap.set("n", "<leader>fC", builtin.commands, { desc = "Find Commands" })
|
||
vim.keymap.set("n", "<leader>f+", builtin.builtin, { desc = "All Pickers" })
|
||
-- Git Pickers
|
||
vim.keymap.set("n", "<leader>fgc", builtin.git_commits, { desc = "Git Commits" })
|
||
vim.keymap.set("n", "<leader>fgC", builtin.git_bcommits, { desc = "Git Buffer Commits" })
|
||
vim.keymap.set("n", "<leader>fgb", builtin.git_branches, { desc = "Git Branches" })
|
||
vim.keymap.set("n", "<leader>fgs", builtin.git_status, { desc = "Git Status" })
|
||
vim.keymap.set("n", "<leader>fgS", builtin.git_stash, { desc = "Git Stash" })
|
||
end
|
||
}
|
||
}
|