From ebcfba12f642fc966b88541af2b518f490cf5b87 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Tue, 24 Jan 2017 23:57:36 +0000 Subject: [PATCH] Add a `RawKey` hook for raw user input hooking Fixes #1132 --- README.asciidoc | 2 ++ doc/manpages/hooks.asciidoc | 4 ++++ src/client.cc | 2 ++ 3 files changed, 8 insertions(+) diff --git a/README.asciidoc b/README.asciidoc index 72c97b2c..b071fbd8 100644 --- a/README.asciidoc +++ b/README.asciidoc @@ -1442,6 +1442,8 @@ existing hooks are: displayed. * `InsertCompletionHide`: Triggered when the insert completion menu gets hidden. + * `RawKey`: Triggered whenever an key is pressed by the user, the key is + used for filtering. When not specified, the filtering text is an empty string. diff --git a/doc/manpages/hooks.asciidoc b/doc/manpages/hooks.asciidoc index 338f0b24..65549692 100644 --- a/doc/manpages/hooks.asciidoc +++ b/doc/manpages/hooks.asciidoc @@ -150,6 +150,10 @@ Default hooks *InsertCompletionHide*:: Triggered when the insert completion menu gets hidden +*RawKey*:: + Triggered whenever an key is pressed by the user, the key is + used for filtering. + When not specified, the filtering text is an empty string. Note that some hooks will not consider underlying scopes depending on what context they are bound to be run into, e.g. the `BufWritePost` hook is a buffer diff --git a/src/client.cc b/src/client.cc index 4d0547ec..638c230c 100644 --- a/src/client.cc +++ b/src/client.cc @@ -85,6 +85,8 @@ bool Client::process_pending_inputs() } else m_input_handler.handle_key(key); + + context().hooks().run_hook("RawKey", key_to_str(key), context()); } catch (Kakoune::runtime_error& error) {