add editor into config
This commit is contained in:
parent
592f436fd4
commit
6cba512c01
2 changed files with 13 additions and 3 deletions
|
@ -21,7 +21,9 @@ def get_config_file():
|
||||||
'# Edit this as you wish\n'
|
'# Edit this as you wish\n'
|
||||||
'\n'
|
'\n'
|
||||||
'[Subprocess]\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(f'Initialized default config file at {str(config_file)}.')
|
||||||
print(config_file)
|
print(config_file)
|
||||||
|
@ -43,3 +45,11 @@ def terminal() -> str:
|
||||||
return d['terminal']
|
return d['terminal']
|
||||||
else:
|
else:
|
||||||
return 'i3-sensible-terminal'
|
return 'i3-sensible-terminal'
|
||||||
|
|
||||||
|
|
||||||
|
def editor() -> str:
|
||||||
|
d = get_config('Subprocess')
|
||||||
|
if 'editor' in d.keys():
|
||||||
|
return d['editor']
|
||||||
|
else:
|
||||||
|
return 'vim'
|
|
@ -4,7 +4,7 @@ import subprocess
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
import os
|
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'):
|
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([
|
subprocess.Popen([
|
||||||
terminal(),
|
terminal(),
|
||||||
"-e",
|
"-e",
|
||||||
f"vim",
|
editor(),
|
||||||
f"--servername {servername}",
|
f"--servername {servername}",
|
||||||
f"--remote-silent",
|
f"--remote-silent",
|
||||||
f"{str(filepath)}"
|
f"{str(filepath)}"
|
||||||
|
|
Loading…
Reference in a new issue