diff --git a/scripts/parse_config.py b/scripts/parse_config.py index 9a6b9c1..c3a383d 100644 --- a/scripts/parse_config.py +++ b/scripts/parse_config.py @@ -21,7 +21,9 @@ def get_config_file(): '# Edit this as you wish\n' '\n' '[Subprocess]\n' - 'terminal = i3-sensible-terminal' + 'terminal = i3-sensible-terminal\n' + 'editor = vim\n' + '' ) print(f'Initialized default config file at {str(config_file)}.') print(config_file) @@ -43,3 +45,11 @@ def terminal() -> str: return d['terminal'] else: return 'i3-sensible-terminal' + + +def editor() -> str: + d = get_config('Subprocess') + if 'editor' in d.keys(): + return d['editor'] + else: + return 'vim' \ No newline at end of file diff --git a/scripts/window_subprocess.py b/scripts/window_subprocess.py index e6636d2..44a184c 100644 --- a/scripts/window_subprocess.py +++ b/scripts/window_subprocess.py @@ -4,7 +4,7 @@ import subprocess from pathlib import Path import os -from parse_config import terminal +from parse_config import terminal, editor def edit(filepath: Path, rootpath: Path = None, env=os.environ, servername='tex lecture'): @@ -13,7 +13,7 @@ def edit(filepath: Path, rootpath: Path = None, env=os.environ, servername='tex subprocess.Popen([ terminal(), "-e", - f"vim", + editor(), f"--servername {servername}", f"--remote-silent", f"{str(filepath)}"