Friday, August 10, 2012

Re: moving tab pages using maps

On 01:00 Fri 10 Aug , sheetal wrote:
> Hello everyone,
>
> What i want to do is map some key<A-S-j/k> such that when ever i press the key i want the current tabpage to be moved previous to a tab/after the next tab and still keep my cursor in the current tab only.
>
> All I wanted to know is this possible and if so, then how can get the current tabpage no.
>
> --
> You received this message from the "vim_use" maillist.
> Do not top-post! Type your reply below the text you are replying to.
> For more information, visit http://www.vim.org/maillist.php

Hi,

It is possible and quite easy:

map <A-S-j> :tabm +1<CR>
map <A-S-k> :tabm -1<CR>

Though I am not sure if I understand you correctly when you write 'keep my
cursor in the current tab'. If you accidentally mean to move to the tab that
replaced the current on in the tab list use this:
map <A-S-j> :tabm +1<bar>tabp<CR>
map <A-S-k> :tabm -1<bar>tabn<CR>

Best,
Marcin

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments: