Support fish shell

This commit is contained in:
Dheepak Krishnamurthy
2020-10-28 01:39:57 -06:00
parent ddc9bffe0f
commit df7ba07b0f

View File

@@ -18,6 +18,10 @@ end
--- Get project_root_dir for git repository
local function project_root_dir()
-- always use bash
local oldshell = vim.o.shell
vim.o.shell = 'bash'
-- try file location first
local gitdir = fn.system('cd "' .. fn.expand('%:p:h') .. '" && git rev-parse --show-toplevel')
local isgitdir = fn.matchstr(gitdir, '^fatal:.*') == ""
@@ -32,6 +36,9 @@ local function project_root_dir()
return trim(gitdir)
end
-- revert to old shell
vim.o.shell = oldshell
-- just return current working directory
return fn.getcwd(0, 0)
end