provide optional arguments to set the path root and thetexinputs variable in edit command
This commit is contained in:
parent
49689e4dd0
commit
d028139860
1 changed files with 8 additions and 2 deletions
|
@ -2,11 +2,17 @@
|
||||||
|
|
||||||
import subprocess
|
import subprocess
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
import os
|
||||||
|
|
||||||
|
|
||||||
def edit(filepath: Path):
|
def edit(filepath: Path, rootpath: Path = None, texinputs=None):
|
||||||
|
env = dict(os.environ)
|
||||||
|
if texinputs:
|
||||||
|
env["TEXINPUTS"] = texinputs
|
||||||
|
if not rootpath:
|
||||||
|
rootpath = filepath
|
||||||
subprocess.Popen([
|
subprocess.Popen([
|
||||||
"termite",
|
"termite",
|
||||||
"-e",
|
"-e",
|
||||||
f"vim --servername tex-vorlesung --remote-silent {str(filepath)}"
|
f"vim --servername tex-vorlesung --remote-silent {str(filepath)}"
|
||||||
])
|
], env=env, cwd=str(rootpath.root))
|
||||||
|
|
Loading…
Reference in a new issue