Search code examples
vim

vim automatically show left tab after closing tab


After closing a tab in vim, how do I make it so that the tab to the left is the one automatically shown?

The default when closing a tab seems to be showing the right tab, which is annoying because new tabs OPEN on the right of your current tab. So opening a new tab and closing it leaves you on a different tab.


Solution

  • Vim8 or Vim9 with the following snippet in ~/.vimrc works for me.

    autocmd TabClosed * tabprevious