From 53c8799ad035ce1649d4bc6ab6cd4297d304a374 Mon Sep 17 00:00:00 2001 From: Marco Hinz Date: Mon, 5 Nov 2018 21:21:43 +0100 Subject: [PATCH] Emit user events on opened buffers Closes #334 --- autoload/startify.vim | 7 +++++++ doc/startify.txt | 20 ++++++++++++++++++-- 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/autoload/startify.vim b/autoload/startify.vim index 801e5d6..077fca9 100644 --- a/autoload/startify.vim +++ b/autoload/startify.vim @@ -410,6 +410,10 @@ function! startify#open_buffers(...) abort endfor wincmd = + + if exists('#User#StartifyAllBuffersOpened') + autocmd User StartifyAllBuffersOpened + endif endfunction " Function: s:get_lists {{{1 @@ -507,6 +511,9 @@ function! s:open_buffer(entry) endif call s:check_user_options(a:entry.path) endif + if exists('#User#StartifyBufferOpened') + autocmd User StartifyBufferOpened + endif endfunction " Function: s:set_custom_section {{{1 diff --git a/doc/startify.txt b/doc/startify.txt index 670f8ed..89d3c2f 100644 --- a/doc/startify.txt +++ b/doc/startify.txt @@ -695,8 +695,24 @@ $PWD and $OLDPWD are ignored. ============================================================================== AUTOCMD *startify-autocmd* -When the Startify buffer is ready, it emits an User event. You can hook into -that to customize Startify even further: +In certain situations Startify emits events which can be hooked into via +|autocmd|s. Those can be used for further customization. + +StartifyReady~ + + When the Startify buffer is ready. + +StartifyBufferOpened~ + + For each buffer that got opened by Startify. When you open multiple files at + once (see |startify-usage|), this event fires multiple times as well. + +StartifyAllBuffersOpened~ + + No matter how many buffers you open, this event fires only once after the + last buffer was opened. + +Example: > autocmd User StartifyReady let &l:stl = ' This statusline rocks!' <