parametrize get_root to be used in different directories

This commit is contained in:
cnrrobertson
2022-10-25 16:15:50 -04:00
parent 9c73fd69a4
commit bed8d6df13

View File

@@ -25,8 +25,7 @@ local function trim(str)
end
local function get_root()
local cwd = vim.loop.cwd()
local function get_root(cwd)
local status, job = pcall(require, 'plenary.job')
if not status then
return fn.system('git rev-parse --show-toplevel')
@@ -55,7 +54,8 @@ local function project_root_dir()
vim.o.shell = 'bash'
end
local root = get_root()
local cwd = vim.loop.cwd()
local root = get_root(cwd)
if root == nil then
return nil
end