History
Article Edit this page Discussion

Move the current tabpage forward or backward

From Vim Tips Wiki

Jump to: navigation, search

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>

Rate this article:

Share this article:

Hubs Highlights International Sites Wikia messages
Entertainment
Gaming
Cartoons & Comics
Science Fiction
Hobbies
Sports
See all...
Grand Theft Auto
Pixar
Legend of Zelda Wiki
Terminator Wiki
Everquest II Wiki
Dark Shadows
German
Spanish
Chinese
Japanese
More...
Wikia is hiring for several open positions


Vote for collaboration of the month.

Send this article to a friend
"Move the current tabpage forward or backward"
 
 
Hi!

I thought you'd like this page from Wikia!

http://vim.wikia.com

Come check it out!
Send confirmation