diff options
author | Denis Kasak <dkasak@users.noreply.github.com> | 2019-02-13 16:31:08 +0100 |
---|---|---|
committer | Keith Smiley <keithbsmiley@gmail.com> | 2019-02-13 07:31:08 -0800 |
commit | d9cd83f6ca08e9ed91ca0cdafd23a5ecd671bae9 (patch) | |
tree | ffd881b603a9b816f540e7ee7f73fae84e1f490c /edit.py | |
parent | 6aface48202f6027f3800e2bd8330ca626fdcbee (diff) | |
download | edit-d9cd83f6ca08e9ed91ca0cdafd23a5ecd671bae9.tar.gz edit-d9cd83f6ca08e9ed91ca0cdafd23a5ecd671bae9.zip |
Respect WEECHAT_HOME. (#6)
Diffstat (limited to 'edit.py')
-rw-r--r-- | edit.py | 7 |
1 files changed, 6 insertions, 1 deletions
@@ -18,10 +18,15 @@ import subprocess import weechat +def weechat_config_dir(): + return os.path.expanduser(os.environ.get("WEECHAT_HOME", "~/.weechat/")) + + def edit(data, buf, args): editor = (weechat.config_get_plugin("editor") or os.environ.get("EDITOR", "vim -f")) - path = os.path.expanduser("~/.weechat/message.txt") + config_dir = weechat_config_dir() + path = os.path.join(config_dir, "message.txt") with open(path, "w+") as f: f.write(weechat.buffer_get_string(buf, "input")) |