diff --git a/docs/advanced.rst b/docs/advanced.rst index ac883915..f5db6ef9 100644 --- a/docs/advanced.rst +++ b/docs/advanced.rst @@ -18,7 +18,7 @@ The configuration file is a simple JSON file with the following options and can - ``journals`` paths to your journal files - ``editor`` - if set, executes this command to launch an external editor for writing your entries, e.g. ``vim``. Some editors require special options to work properly, see :doc:`FAQ ` for details. + if set, executes this command to launch an external editor for writing your entries, e.g. ``vim``. Some editors require special options to work properly, see :doc:`FAQ ` for details. This value can either be a string such as the earlier ``"editor": "vim"`` example or ``"editor": ["vim", "+set ft=markdown"]`` if you want to pass arguments to the editor. - ``encrypt`` if ``true``, encrypts your journal using AES. - ``tagsymbols`` diff --git a/jrnl/util.py b/jrnl/util.py index e9df0fb1..47cb5a18 100644 --- a/jrnl/util.py +++ b/jrnl/util.py @@ -130,7 +130,9 @@ 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]) + editor = config['editor'] + args = editor if isinstance(editor, list) else editor.split() + subprocess.call(args + [tmpfile]) with codecs.open(tmpfile, "r", "utf-8") as f: raw = f.read() os.remove(tmpfile)