Keep new changes on right

Saves and restores splitright option
Backported from 512df2948
This commit is contained in:
Balakrishnan Balasubramanian 2023-03-06 10:53:14 -05:00
parent 6b37b6e50f
commit 32e186695a

View File

@ -67,6 +67,11 @@ def main():
args = parse_args()
vimCmdFile = tempfile.NamedTemporaryFile(mode='w', delete=False)
with vimCmdFile:
cmds = f"""
let s:spr = &splitright
set splitright
"""
print(cmds, file=vimCmdFile)
for a, b in get_file_pairs(args.pathA, args.pathB):
aPath = a.resolve() if a else os.devnull
bPath = b.resolve() if b else os.devnull
@ -74,6 +79,10 @@ def main():
f"tabedit {aPath} | diffthis | vsp {bPath} | diffthis | diffupdate",
file=vimCmdFile)
cmds = f"""
let &splitright = s:spr
tabdo windo :1
tabdo windo diffthis
tabdo windo diffupdate
tabfirst | tabclose
call delete("{vimCmdFile.name}")
"""