aboutsummaryrefslogtreecommitdiff
path: root/edit.py
diff options
context:
space:
mode:
Diffstat (limited to 'edit.py')
-rw-r--r--edit.py15
1 files changed, 9 insertions, 6 deletions
diff --git a/edit.py b/edit.py
index fe2919f..5075ddc 100644
--- a/edit.py
+++ b/edit.py
@@ -83,12 +83,15 @@ def read_file(buf):
def hook_editor_process(terminal, editor, buf):
- term_cmd = "{} -e".format(terminal)
- editor_cmd = "{} {}".format(editor, FILE)
- weechat.hook_process("{} \"{}\"".format(
- term_cmd,
- editor_cmd
- ), 0, "editor_process_cb", buf)
+ if "{}" in editor:
+ editor_cmd = editor.format(FILE)
+ else:
+ editor_cmd = "{} {}".format(editor, FILE)
+ if "{}" in terminal:
+ command = terminal.format(editor_cmd)
+ else:
+ command = "{} -e \"{}\"".format(terminal, editor_cmd)
+ weechat.hook_process(command, 0, "editor_process_cb", buf)
def run_blocking(editor, buf):