Merge remote-tracking branch 'icetan/buffer-reload-hook'

This commit is contained in:
Maxime Coste 2018-07-19 08:29:22 +10:00
commit 56912dd22c
3 changed files with 7 additions and 1 deletions

View File

@ -106,6 +106,10 @@ of the given *group*.
*BufWritePost* `filename`::
executed just after a buffer is written
*BufReload* `filename`::
executed after a buffer reload has been triggered by an external
modification to its file
*BufClose* `buffer name`::
executed when a buffer is deleted, while it is still valid

View File

@ -283,6 +283,8 @@ void Client::reload_buffer()
reload_file_buffer(buffer);
context().print_status({ format("'{}' reloaded", buffer.display_name()),
context().faces()["Information"] });
m_window->hooks().run_hook("BufReload", buffer.name(), context());
}
catch (runtime_error& error)
{

View File

@ -801,7 +801,7 @@ const CommandDesc remove_highlighter_cmd = {
};
static constexpr auto hooks = {
"BufCreate", "BufNewFile", "BufOpenFile", "BufClose", "BufWritePost",
"BufCreate", "BufNewFile", "BufOpenFile", "BufClose", "BufWritePost", "BufReload",
"BufWritePre", "BufOpenFifo", "BufCloseFifo", "BufReadFifo", "BufSetOption",
"InsertBegin", "InsertChar", "InsertDelete", "InsertEnd", "InsertIdle", "InsertKey",
"InsertMove", "InsertCompletionHide", "InsertCompletionShow", "InsertCompletionSelect",