I jsut switched from sublime text to vim and I'm trying to replicate sublime's tab view.
I usually have a vertical split opened with :vsp
and each split I'd like to open new tabs. To do this I type in bufdo tab split
but it opens a new tab over my split and not within the split.
How can I open the tab within the split?
Many thanks
Pressing Alt-F12 opens a window listing the buffers, and you can press Enter on a buffer name to go to that buffer. Or, press F12 (next) or Shift-F12 (previous) to cycle through the buffers.
7 Answers. Show activity on this post. s will open the file currently under the cursor in a new vertically split window. Use t to open in a new tab.
Opening a tab Probably the easiest to remember is to run the :tabnew command while in normal mode. This will open a new tab with an empty buffer. If you want to edit a file in the new tab, you can run :tabnew filename and Vim will load the file in the new tab.
To Open a tab, editing the current file's name you can use %
, which acts as a macro for the current file:
:tabe %
To Open a new tab & show the current file's directory:
:Te
or :tabe %:h
To move between opened tabs:
gt # Go to next tab
gT # Go to previous tab
In Vim, each edited file corresponds to a buffer. These are displayed in windows. Multiple windows can be split. Multiple such an arrangements of window(s) can be switched to in tab pages (this is a more recent addition).
In this hierarchy, the tab pages are always "above" the windows, so there can only be one single tabline that structures the tab pages. (And it's always between the menu / window title and the windows.)
In Vim, working with window splits is preferred over tab pages. It's recommended to use the latter only to separate different workspaces / projects, etc. Vim is very powerful (and with a long heritage), so you cannot directly take over concepts seen in other editors.
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