editor: use shell to launch editor to allow spaces in editor command

If I want to set a filetype in vim on opening the journla, e.g.:

  vim -c 'set ft=notes' -c Goyo -f

the set and ft=notes will be split and interpreted as two files in vim.
Using the shell to execute the command makes it possible to have editor
commands with quoted/escaped spaces in them.
This commit is contained in:
Gaute Hope 2016-08-19 10:39:07 +02:00
parent 4aa458d31a
commit 460179efdd

View file

@ -130,7 +130,7 @@ 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)
subprocess.call(config['editor'].split() + [tmpfile]) subprocess.call(config['editor'] + " " + tmpfile, shell = True)
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)