diff --git a/README.asciidoc b/README.asciidoc index 1073d7a6..2984620a 100644 --- a/README.asciidoc +++ b/README.asciidoc @@ -407,6 +407,9 @@ existing hooks are: * +BufCreate+: A buffer has been created, filename is used for filtering * +RuntimeError+: an error was encountered while executing an user command the error message is used for filtering + * +KakBegin+: Kakoune started, this is called just after reading the user + configuration files + * +KakEnd+: Kakoune is quitting. when not specified, the filtering text is an empty string. diff --git a/src/main.cc b/src/main.cc index 7696ab69..2164e35d 100644 --- a/src/main.cc +++ b/src/main.cc @@ -243,6 +243,11 @@ int main(int argc, char* argv[]) write_debug("error while parsing kakrc: asked to quit"); } + { + Context empty_context; + global_hooks.run_hook("KakBegin", "", empty_context); + } + if (parser.positional_count() != 0) { // create buffers in reverse order so that the first given buffer @@ -261,6 +266,11 @@ int main(int argc, char* argv[]) while (not client_manager.empty()) event_manager.handle_next_events(); + + { + Context empty_context; + global_hooks.run_hook("KakEnd", "", empty_context); + } } catch (Kakoune::exception& error) {