summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/core/wee-command.c2
-rw-r--r--src/plugins/fset/fset-command.c40
2 files changed, 40 insertions, 2 deletions
diff --git a/src/core/wee-command.c b/src/core/wee-command.c
index ab3290ee4..0b1e98cd7 100644
--- a/src/core/wee-command.c
+++ b/src/core/wee-command.c
@@ -8356,7 +8356,7 @@ command_init ()
hook_command (
NULL, "key",
N_("bind/unbind keys"),
- N_("list|listdefault|listdiff [<context>]"
+ N_("[list|listdefault|listdiff] [<context>]"
" || bind <key> [<command> [<args>]]"
" || bindctxt <context> <key> [<command> [<args>]]"
" || unbind <key>"
diff --git a/src/plugins/fset/fset-command.c b/src/plugins/fset/fset-command.c
index 5cfb1b514..7ab4f3a5d 100644
--- a/src/plugins/fset/fset-command.c
+++ b/src/plugins/fset/fset-command.c
@@ -454,7 +454,6 @@ fset_command_run_set_cb (const void *pointer, void *data,
/* make C compiler happy */
(void) pointer;
(void) data;
- (void) buffer;
/* ignore /set command if issued on fset buffer */
if (fset_buffer && (buffer == fset_buffer))
@@ -576,6 +575,44 @@ end:
}
/*
+ * Hooks execution of command "/key".
+ */
+
+int
+fset_command_run_key_cb (const void *pointer, void *data,
+ struct t_gui_buffer *buffer, const char *command)
+{
+ const char *ptr_args;
+
+ /* make C compiler happy */
+ (void) pointer;
+ (void) data;
+ (void) buffer;
+
+ if (strncmp (command, "/key", 4) != 0)
+ return WEECHAT_RC_OK;
+
+ ptr_args = strchr (command, ' ');
+ while (ptr_args && (ptr_args[0] == ' '))
+ {
+ ptr_args++;
+ }
+
+ if (!ptr_args || !ptr_args[0])
+ {
+ fset_option_filter_options ("weechat.key*");
+ if (!fset_buffer)
+ fset_buffer_open ();
+ fset_buffer_set_localvar_filter ();
+ fset_buffer_refresh (1);
+ weechat_buffer_set (fset_buffer, "display", "1");
+ return WEECHAT_RC_OK_EAT;
+ }
+
+ return WEECHAT_RC_OK;
+}
+
+/*
* Hooks fset commands.
*/
@@ -807,4 +844,5 @@ fset_command_init ()
" || *|c:|f:|s:|d|d:|d=|d==|=|==|%(fset_options)",
&fset_command_fset, NULL, NULL);
weechat_hook_command_run ("/set", &fset_command_run_set_cb, NULL, NULL);
+ weechat_hook_command_run ("/key", &fset_command_run_key_cb, NULL, NULL);
}