mirror of
https://github.com/jrnl-org/jrnl.git
synced 2025-05-20 04:58:32 +02:00
Allow list of arguments instead of string in config['editor']
This helps whenever your editor commandline needs to escape spaces, for example: vim -c set\ filetype=markdown can now go in your config file as: { "editor": ["vim", "-c", "set filetype=markdown"] }
This commit is contained in:
parent
c0050c3d23
commit
ec93ffcd16
1 changed files with 6 additions and 1 deletions
|
@ -130,7 +130,12 @@ def get_text_from_editor(config, template=""):
|
||||||
with codecs.open(tmpfile, 'w', "utf-8") as f:
|
with codecs.open(tmpfile, 'w', "utf-8") as f:
|
||||||
if template:
|
if template:
|
||||||
f.write(template)
|
f.write(template)
|
||||||
|
try:
|
||||||
|
iter(config['editor'])
|
||||||
|
except:
|
||||||
subprocess.call(config['editor'].split() + [tmpfile])
|
subprocess.call(config['editor'].split() + [tmpfile])
|
||||||
|
else:
|
||||||
|
subprocess.call(config['editor'] + [tmpfile])
|
||||||
with codecs.open(tmpfile, "r", "utf-8") as f:
|
with codecs.open(tmpfile, "r", "utf-8") as f:
|
||||||
raw = f.read()
|
raw = f.read()
|
||||||
os.remove(tmpfile)
|
os.remove(tmpfile)
|
||||||
|
|
Loading…
Add table
Reference in a new issue