I close a tab in vim and immediately realize I need to re-open it again for something. Is there a way to undo close tab in Vim 7.2?
You can type Ctrl-W c to close the current window. If that window is the last window visible in a tab, the tab is also closed (if another tab page is currently open).
In gnome-terminal, I can just press Alt + ( 1 , 2 , 3 , etc.) to switch to specific tabs. I can also use Ctrl + ( PgUp / PgDn ) to cycle through tabs (admittedly less convenient, but it can be remapped). If I want to use vim tabs instead of gnome-terminal tabs, typing :tabn and :tabp is quite cumbersome.
Your file is probably still open in a buffer:
:ls " get the buffer number :tabnew +Nbuf " where N is the buffer number
To reopen buffer 18, for example:
:tabnew +18buf
:tabnew#
Reopens recently closed file in new tab
Edit: Please use greyfade's answer. I don't like my answer, but I'm keeping it here for references and useful comment info.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With