From ec93ffcd1652ab7c568cef05eaf72792020fc8c6 Mon Sep 17 00:00:00 2001 From: "James D. Amberger" Date: Wed, 8 Aug 2018 05:01:07 -0400 Subject: [PATCH] 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"] } --- jrnl/util.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/jrnl/util.py b/jrnl/util.py index e9df0fb1..c5d5d9b7 100644 --- a/jrnl/util.py +++ b/jrnl/util.py @@ -130,7 +130,12 @@ def get_text_from_editor(config, template=""): with codecs.open(tmpfile, 'w', "utf-8") as f: if template: f.write(template) - subprocess.call(config['editor'].split() + [tmpfile]) + try: + iter(config['editor']) + except: + subprocess.call(config['editor'].split() + [tmpfile]) + else: + subprocess.call(config['editor'] + [tmpfile]) with codecs.open(tmpfile, "r", "utf-8") as f: raw = f.read() os.remove(tmpfile)