diff options
author | A Farzat <a@farzat.xyz> | 2022-05-18 13:03:03 +0900 |
---|---|---|
committer | A Farzat <a@farzat.xyz> | 2022-05-18 13:03:03 +0900 |
commit | a2c393fbc88956a78ab40d64900735a0f388b77e (patch) | |
tree | b95b6fcc58cfe7213b76596da6c1b1c2b3c0624a /edit.py | |
parent | 2e5a91a211714566bb81a388eb1ad0b56d3ea6e3 (diff) | |
download | edit-a2c393fbc88956a78ab40d64900735a0f388b77e.tar.gz edit-a2c393fbc88956a78ab40d64900735a0f388b77e.zip |
Add default settings and setting descriptions
Diffstat (limited to 'edit.py')
-rw-r--r-- | edit.py | 24 |
1 files changed, 24 insertions, 0 deletions
@@ -21,6 +21,21 @@ import shlex import subprocess import weechat +# script options +SETTINGS = { + "editor": ( + "", + "The editor command. You can customize by inserting the \{\} " + "placeholder in place of the filename."), + "terminal": ( + "", + "The terminal command. You can customize by inserting the \{\} " + "placeholder in place of the editor command."), + "run_externally": ( + "off", + "Run the editor externallly (using the terminal command)."), +} + FILE = "" FENCED = False @@ -144,6 +159,15 @@ def main(): "Open your $EDITOR to compose a message", "", ""): return weechat.WEECHAT_RC_ERROR + # set default settings + version = weechat.info_get('version_number', '') or 0 + for option, value in SETTINGS.items(): + if not weechat.config_is_set_plugin(option): + weechat.config_set_plugin(option, value[0]) + if int(version) >= 0x00030500: + weechat.config_set_desc_plugin( + option, '%s (default: "%s")' % (value[1], value[0])) + weechat.hook_command("edit", "Open your $EDITOR to compose a message", "[extension]", "extension: extension for temporary composing file", |