add editor into config

This commit is contained in:
Maximilian Keßler 2022-05-01 21:07:15 +02:00
parent 592f436fd4
commit 6cba512c01
2 changed files with 13 additions and 3 deletions

View file

@ -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'

View file

@ -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)}"