This commit is contained in:
Josh Davis 2017-04-16 08:34:53 +00:00 committed by GitHub
commit 820d0a183f
2 changed files with 4 additions and 2 deletions

View file

@ -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 <recipes>` 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 <recipes>` 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``

View file

@ -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)