Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I move an existing window to a new tab?

Tags:

vim

People also ask

How do you move tabs on a laptop?

On Windows, use Ctrl-Tab to move to the next tab to the right and Ctrl-Shift-Tab to move to the next tab to the left.

How do you change tabs in Vim?

To close a tab, use :tabc. To switch to the next tab, use :tabn, and to switch to the previous tab, use :tabp (short for tabnext and tabprevious respectively). You can also jump over tabs by using :tabn 2, which will move to the second next tab.


As well as the previously suggested :tabedit approach, a quicker way of doing it is (in normal mode) to hit Ctrl-W Shift-T. Ctrl-W is the general prefix for a wide variety of window manipulation commands.

See:

:help Ctrl-W_T
:help Ctrl-W

Try

:tabedit %<CR>

This moves the newest buffer in a new tab and restores the previous buffer in the current tab. I use this after dragging a new file into my Gvim

:sbp |wincmd p| wincmd T

You can map it like that to Ctrl-Backspace

:nnoremap <C-BS> :sbp<bar>wincmd p<bar>wincmd T<CR>

it performs especially well with

:set switchbuf=usetab