In Vim, I use the Startify plugin. There's a few ways to open new Vim tabs with this plugin; and I would like to configure my Vim to ensure that :tcd %:h
is executed automatically for the first buffer opened into a new Tab after executing Startify.
For purposes like this, Startify provides the StartifyBufferOpened
autocmd. Unfortunately, this is executed for every buffer that you open with Startify. Similarly, I'm aware of Vim's built-in TabNew
; but this fires any time a new tabpage is created; I only want to :tcd
in the tabpages created by Startify.
Is there a VimScript function I could construct that would, when evaluated in several new buffers (i.e. by StartifyBufferOpened
), only actually run a particular command if a new tabpage was just created for that buffer?