Make LazyGitConfig work

This commit is contained in:
Dheepak Krishnamurthy
2020-08-09 19:50:06 -06:00
parent 52689d49bc
commit 4c337c8b12

View File

@@ -26,8 +26,8 @@ local function project_root_dir()
end
-- try symlinked file location instead
local gitdir = fn.system('cd "' .. fn.fnamemodify(fn.resolve(fn.expand('%:p')), ':h') .. '" && git rev-parse --show-toplevel')
local isgitdir = fn.matchstr(gitdir, '^fatal:.*') == ""
gitdir = fn.system('cd "' .. fn.fnamemodify(fn.resolve(fn.expand('%:p')), ':h') .. '" && git rev-parse --show-toplevel')
isgitdir = fn.matchstr(gitdir, '^fatal:.*') == ""
if isgitdir then
return trim(gitdir)
end
@@ -178,11 +178,11 @@ local function lazygitconfig()
-- directory does not exist
fn.mkdir(fn.fnamemodify(config_file, ":h"))
end
vim.cmd('edit "' .. config_file .. '"')
vim.cmd('edit ' .. config_file)
vim.cmd([[execute "silent! 0read !lazygit -c"]])
vim.cmd([[execute "normal 1G"]])
else
vim.cmd('edit "' .. config_file .. '"')
vim.cmd('edit ' .. config_file)
end
end