From 6e7a75e9d0ec4a9e112f4b9cc6a8946a0c40d5b2 Mon Sep 17 00:00:00 2001 From: Josh Davis Date: Sun, 11 Jan 2015 20:16:21 -0800 Subject: [PATCH 1/2] Allow editor config value to be either list or str --- jrnl/util.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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) From cb972f511c58c71c7825f62f9ba753d3aad22b12 Mon Sep 17 00:00:00 2001 From: Josh Davis Date: Sun, 11 Jan 2015 20:21:56 -0800 Subject: [PATCH 2/2] Add documentation on advanced editor config --- docs/advanced.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/advanced.rst b/docs/advanced.rst index e28975fe..07611b1a 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``