Move the current tabpage forward or backward
From Vim Tips Wiki
Tip 1233 Previous Next Created: May 16, 2006 Complexity: basic Author: Won, Ju-yeon Version: n/a
You can use :tabm command to move the current tabpage. The following mappings will help you move the current tabpage easily.
Copy the following into your vimrc:
nn <silent> <M-.> :if tabpagenr() == tabpagenr("$")\|tabm 0\|el\|exe "tabm ".tabpagenr()\|en<CR>
nn <silent> <M-,> :if tabpagenr() == 1\|exe "tabm ".tabpagenr("$")\|el\|exe "tabm ".(tabpagenr()-2)\|en<CR>
To activate the movement, press Alt-. or Alt-,
[edit] Comments
Why not use :tabprevious or :tabnext?
:tabprevious command is to set a focus to the previous tabpage. The above mappings are to move the current tabpage forward or backward.
A slightly less complex version:
noremap <silent> <M-Left> :exe "silent! tabmove " . (tabpagenr() - 2)<CR> noremap <silent> <M-Right> :exe "silent! tabmove " . tabpagenr()<CR>
