mirror of
https://github.com/itme-brain/nixos.git
synced 2026-03-24 08:39:42 -04:00
moar
This commit is contained in:
parent
4c8fadee55
commit
12b6749545
2 changed files with 16 additions and 1 deletions
|
|
@ -1,3 +1,12 @@
|
|||
local function git_root()
|
||||
local git_dir = vim.fn.systemlist("git rev-parse --show-toplevel")[1]
|
||||
if git_dir and git_dir ~= "" then
|
||||
return git_dir
|
||||
else
|
||||
return vim.fn.getcwd() -- Fallback to current working directory if not in a Git repo
|
||||
end
|
||||
end
|
||||
|
||||
return {
|
||||
{
|
||||
"nvim-telescope/telescope.nvim",
|
||||
|
|
@ -11,7 +20,13 @@ return {
|
|||
}
|
||||
},
|
||||
config = function()
|
||||
-- Custom Telescope command to grep from Git root
|
||||
vim.api.nvim_set_keymap('n', '<leader>lg', "<cmd>lua require('telescope.builtin').live_grep({ cwd = git_root() })<CR>", { noremap = true, silent = true })
|
||||
require("which-key").add({
|
||||
{ "<leader>/", function()
|
||||
require('telescope.builtin').live_grep({ cwd = git_root() })
|
||||
end,
|
||||
desc = "grep" },
|
||||
{ "<leader>/", ":Telescope live_grep<CR>", desc = "grep" },
|
||||
{ "<leader>ff", ":Telescope fd<CR>", desc = "Search for Files" },
|
||||
{ "<leader>fp", ":Telescope oldfiles<CR>", desc = "Oldfiles" },
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue