Vim Pro tip – Edit the current buffer in a new tab


Quite often I found in vim that I would like the current buffer in a new tab, I use a lot the vertical and horizontal splits in vim, then I reach the limit (my screen limit) for the vertical/horizontal splits, this means: if I add a new vertical split the code looks ugly even if it respects the 80 columns width, or if add a new horizontal split there would be just too few lines that is not worth to keep the buffer.

Then I used open a new tab, type


then type the path to the buffer I like to edit. Until now, now I open a new tab, then type


check then number of the buffer I want in this new tab and then type


being “X” the number of the buffer, ej “:b2“. Another trick is to type


for the next buffer or


for the previous.