Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change tabs order in VIM?

Tags:

vim

tabs

nerdtree

Is there a way to change tabs order in Vim (i.e. change the position of the tabs in the tab bar)? For example, let's say my current tabs are in this order:

A | B | C | D 

But I would like to switch the position of the tabs to something like:

A | C | B | D 

How can I do that?

like image 338
nothing-special-here Avatar asked Jul 02 '12 14:07

nothing-special-here


People also ask

How do I reorder tabs in Vim?

Rearranging tabs If you're really meticulous and want to position tabs just so in Vim, you can move the tabs to a specific spot in the tab order using :tabm n , where n is the position number that you want to use. If you don't give the :tabm command an argument, then the current tab will be moved to the last spot.

How do I change tabs in Neovim?

Ctrl + → will switch to tab that is on the right of current tab. Ctrl + ↑ will switch to first tab. Ctrl + ↓ will switch to last tab. This works with vim-airline plugin as well.


1 Answers

You can use :tabmove followed by the tab number to move past. For example, :tabmove 3 will make the current tab move past the 3rd. :tabmove 0 moves to the beginning and :tabmove (without a number) moves to the end.

Another way - though not orthodox - is to enable mouse via :set mouse=a and drag-and-drop tabs around. It might look simpler for a start.

like image 84
Mihai Maruseac Avatar answered Sep 19 '22 10:09

Mihai Maruseac