How can I change the position / order of my current tab in Vim
? For example, if I want to reposition my current tab to be the first tab?
In addition to the fine suggestions in other answers, you can also simply drag tabs with the mouse to move them, if you have mouse support enabled.
This is on by default in MacVim and other GUI vim implementations, whether using the GUI widget tabs or the terminal style tabs in GUI mode.
It also works in pure tty mode Vim, if you have set mouse=a
and have a suitable terminal (xterm and most emulators of it, such as gnome-terminal, Terminal.app, iTerm2, and PuTTY/KiTTY, to name a view). Note that mouse clicks beyond column 222 also require set ttymouse=sgr
; see In Vim, why doesn't my mouse work past the 220th column? for background on that.
I've written a plugin called vim-tabber that provides some additional functionality for swapping tabs around, shifting them, and adding to the capabilities of the built-in tab manipulation commands, while remaining largely compatible with the builtins. Even if you choose not to use the plugin, there's some general tab usage information in the README.