diff options
author | A Farzat <a@farzat.xyz> | 2022-05-18 10:41:01 +0900 |
---|---|---|
committer | A Farzat <a@farzat.xyz> | 2022-05-18 10:41:01 +0900 |
commit | 66ea1c1f3fe6602eee4233cd2ef10010a8a13f13 (patch) | |
tree | 4fa886f6cece44049a01ec5430d3e80a0c0a67ab /edit.py | |
parent | c8ed1d668ed22a9bc568934eab0f4102ae9dafb6 (diff) | |
download | edit-66ea1c1f3fe6602eee4233cd2ef10010a8a13f13.tar.gz edit-66ea1c1f3fe6602eee4233cd2ef10010a8a13f13.zip |
Make the editor and terminal options more flexible
This is to support tmux better. Maintains backward compatibility.
Diffstat (limited to 'edit.py')
-rw-r--r-- | edit.py | 15 |
1 files changed, 9 insertions, 6 deletions
@@ -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): |