From 12b6749545b1b1f4238712521cf5351e84cccdef Mon Sep 17 00:00:00 2001 From: Bryan Ramos Date: Tue, 20 Aug 2024 17:11:27 -0400 Subject: [PATCH] moar --- nvim/lua/plugins/lualine.lua | 2 +- nvim/lua/plugins/telescope.lua | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/nvim/lua/plugins/lualine.lua b/nvim/lua/plugins/lualine.lua index 46fcf8b..c5f8a37 100644 --- a/nvim/lua/plugins/lualine.lua +++ b/nvim/lua/plugins/lualine.lua @@ -6,7 +6,7 @@ return { require("lualine").setup ({ options = { icons_enabled = true, - theme = 'iceberg_dark', + theme = 'material', component_separators = { left = '>', right = '|'}, section_separators = { left = '', right = ''}, disabled_filetypes = { diff --git a/nvim/lua/plugins/telescope.lua b/nvim/lua/plugins/telescope.lua index 58021ce..2c150af 100644 --- a/nvim/lua/plugins/telescope.lua +++ b/nvim/lua/plugins/telescope.lua @@ -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', 'lg', "lua require('telescope.builtin').live_grep({ cwd = git_root() })", { noremap = true, silent = true }) require("which-key").add({ + { "/", function() + require('telescope.builtin').live_grep({ cwd = git_root() }) + end, + desc = "grep" }, { "/", ":Telescope live_grep", desc = "grep" }, { "ff", ":Telescope fd", desc = "Search for Files" }, { "fp", ":Telescope oldfiles", desc = "Oldfiles" },