From a2c393fbc88956a78ab40d64900735a0f388b77e Mon Sep 17 00:00:00 2001 From: A Farzat Date: Wed, 18 May 2022 13:03:03 +0900 Subject: Add default settings and setting descriptions --- edit.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'edit.py') diff --git a/edit.py b/edit.py index 8bff9f4..7c49034 100644 --- a/edit.py +++ b/edit.py @@ -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", -- cgit v1.2.3-70-g09d2