From 83a1232f6bb7d4b20c0cfa50b3a0a769517675ea Mon Sep 17 00:00:00 2001 From: sommerfeld Date: Fri, 17 Apr 2026 10:53:00 +0100 Subject: refactor(nvim): rename telescope.lua to search.lua The file contains fzf-lua configuration, not telescope. Name now reflects actual content. --- home/.config/nvim/lua/custom/plugins/search.lua | 181 ++++++++++++++++++++++++ 1 file changed, 181 insertions(+) create mode 100644 home/.config/nvim/lua/custom/plugins/search.lua (limited to 'home/.config/nvim/lua/custom/plugins/search.lua') diff --git a/home/.config/nvim/lua/custom/plugins/search.lua b/home/.config/nvim/lua/custom/plugins/search.lua new file mode 100644 index 0000000..d3100c1 --- /dev/null +++ b/home/.config/nvim/lua/custom/plugins/search.lua @@ -0,0 +1,181 @@ +return { + { + "ibhagwan/fzf-lua", + branch = "main", + keys = { + { + "b", + function() + require("fzf-lua").buffers() + end, + desc = "fzf-lua by [G]rep", + }, + { + "g", + function() + require("fzf-lua").live_grep() + end, + desc = "fzf-lua by [G]rep", + }, + { + "f", + function() + require("fzf-lua").files() + end, + desc = "fzf-lua [F]iles", + }, + { + "", + function() + require("fzf-lua").global() + end, + desc = "fzf-lua global picker", + }, + { + "d", + function() + require("fzf-lua").diagnostics() + end, + desc = "fzf-lua [D]iagnostics", + }, + { + "r", + function() + require("fzf-lua").resume() + end, + desc = "fzf-lua [R]esume", + }, + { + "gc", + function() + require("fzf-lua").git_bcommits() + end, + desc = "[G]it buffer [C]commits", + }, + { + "gc", + function() + require("fzf-lua").git_bcommits_range() + end, + desc = "[G]it [C]commits for selected range", + }, + { + "gC", + function() + require("fzf-lua").git_commits() + end, + desc = "[G]it (all) [C]commits", + }, + { + "gb", + function() + require("fzf-lua").git_branches() + end, + desc = "[G]it [B]ranches", + }, + { + "gs", + function() + require("fzf-lua").git_status() + end, + desc = "[G]it [S]tatus", + }, + { + "gS", + function() + require("fzf-lua").git_stash() + end, + desc = "[G]it [S]tash", + }, + }, + config = function() + local fzflua = require("fzf-lua") + fzflua.setup({ + keymap = { + builtin = { + true, + [""] = "toggle-preview", + }, + }, + grep = { + hidden = true, + RIPGREP_CONFIG_PATH = "~/.config/ripgrep/ripgreprc", + }, + lsp = { + includeDeclaration = false, + }, + actions = { + files = { + true, + ["ctrl-x"] = FzfLua.actions.file_split, + }, + }, + }) + vim.api.nvim_create_autocmd("LspAttach", { + callback = function(event) + local bnmap = function(keys, func, desc) + vim.keymap.set( + "n", + keys, + func, + { buffer = event.buf, desc = "LSP: " .. desc } + ) + end + bnmap("gd", fzflua.lsp_definitions, "[G]oto [D]efinition") + bnmap("gvd", function() + fzflua.lsp_definitions({ jump1_action = fzflua.actions.file_vsplit }) + end, "[G]oto in a [V]ertical split to [D]efinition") + bnmap("gxd", function() + fzflua.lsp_definitions({ jump1_action = fzflua.actions.file_split }) + end, "[G]oto in a [X]horizontal split to [D]efinition") + bnmap("gtd", function() + fzflua.lsp_definitions({ + jump1_action = fzflua.actions.file_tabedit, + }) + end, "[G]oto in a [T]ab to [D]efinition") + bnmap("D", fzflua.lsp_typedefs, "Type [D]efinition") + bnmap("vD", function() + fzflua.lsp_typedefs({ jump1_action = fzflua.actions.file_vsplit }) + end, "Open in a [V]ertical split Type [D]efinition") + bnmap("xD", function() + fzflua.lsp_typedefs({ jump1_action = fzflua.actions.file_split }) + end, "Open in a [X]horizontal split Type [D]efinition") + bnmap("tD", function() + fzflua.lsp_typedefs({ jump1_action = fzflua.actions.file_tabedit }) + end, "Open in a [T]ab Type [D]efinition") + bnmap("gri", fzflua.lsp_implementations, "[G]oto [I]mplementation") + bnmap("grvi", function() + fzflua.lsp_implementations({ + jump1_action = fzflua.actions.file_vsplit, + }) + end, "[G]oto in a [V]ertical split to [I]mplementation") + bnmap("grxi", function() + fzflua.lsp_implementations({ + jump1_action = fzflua.actions.file_split, + }) + end, "[G]oto in a [X]horizontal split to [I]mplementation") + bnmap("grti", function() + fzflua.lsp_implementations({ + jump1_action = fzflua.actions.file_tabedit, + }) + end, "[G]oto in a [T]ab to [I]mplementation") + bnmap("grr", fzflua.lsp_references, "[G]oto [R]eferences") + bnmap("ic", fzflua.lsp_incoming_calls, "[I]ncoming [C]alls") + bnmap("oc", fzflua.lsp_outgoing_calls, "[O]utgoing [C]alls") + bnmap("gO", fzflua.lsp_document_symbols, "d[O]ocument symbols") + bnmap( + "ws", + fzflua.lsp_live_workspace_symbols, + "[W]orkspace [S]ymbols" + ) + bnmap( + "wd", + fzflua.diagnostics_workspace, + "[W]orkspace [D]iagnostics" + ) + end, + }) + fzflua.register_ui_select() + end, + }, +} -- cgit v1.2.3-70-g09d2