parametrize get_root to be used in different directories
This commit is contained in:
@@ -25,8 +25,7 @@ local function trim(str)
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
local function get_root()
|
local function get_root(cwd)
|
||||||
local cwd = vim.loop.cwd()
|
|
||||||
local status, job = pcall(require, 'plenary.job')
|
local status, job = pcall(require, 'plenary.job')
|
||||||
if not status then
|
if not status then
|
||||||
return fn.system('git rev-parse --show-toplevel')
|
return fn.system('git rev-parse --show-toplevel')
|
||||||
@@ -55,7 +54,8 @@ local function project_root_dir()
|
|||||||
vim.o.shell = 'bash'
|
vim.o.shell = 'bash'
|
||||||
end
|
end
|
||||||
|
|
||||||
local root = get_root()
|
local cwd = vim.loop.cwd()
|
||||||
|
local root = get_root(cwd)
|
||||||
if root == nil then
|
if root == nil then
|
||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user