aboutsummaryrefslogtreecommitdiffstats
path: root/lua/plugins/spectre.lua
diff options
context:
space:
mode:
Diffstat (limited to 'lua/plugins/spectre.lua')
-rw-r--r--lua/plugins/spectre.lua7
1 files changed, 4 insertions, 3 deletions
diff --git a/lua/plugins/spectre.lua b/lua/plugins/spectre.lua
index e3840af..4dcc782 100644
--- a/lua/plugins/spectre.lua
+++ b/lua/plugins/spectre.lua
@@ -2,11 +2,12 @@
---@param default_opts table | nil
---@return table
function _G.get_spectre_options(default_opts)
- local Path = require("utils.path")
local opts = default_opts or {}
- if Path.is_git_repo() then
- opts.cwd = Path.get_git_root()
+ -- Check if we're in a git repository and get the root
+ local git_root = vim.fn.system("git rev-parse --show-toplevel 2>/dev/null")
+ if vim.v.shell_error == 0 then
+ opts.cwd = vim.trim(git_root)
end
return opts