2021-09-17 09:43:54 +02:00
|
|
|
#! /usr/bin/python3
|
|
|
|
|
|
|
|
import subprocess
|
|
|
|
from pathlib import Path
|
2021-09-18 14:16:53 +02:00
|
|
|
import os
|
2021-09-17 09:43:54 +02:00
|
|
|
|
|
|
|
|
2021-09-18 14:16:53 +02:00
|
|
|
def edit(filepath: Path, rootpath: Path = None, texinputs=None):
|
|
|
|
env = dict(os.environ)
|
|
|
|
if texinputs:
|
|
|
|
env["TEXINPUTS"] = texinputs
|
|
|
|
if not rootpath:
|
|
|
|
rootpath = filepath
|
2021-09-17 09:43:54 +02:00
|
|
|
subprocess.Popen([
|
|
|
|
"termite",
|
|
|
|
"-e",
|
|
|
|
f"vim --servername tex-vorlesung --remote-silent {str(filepath)}"
|
2021-09-18 14:16:53 +02:00
|
|
|
], env=env, cwd=str(rootpath.root))
|