This two functions allows to move window between tabs:
function MoveToPrevTab() "there is only one window if tabpagenr('$') == 1 && winnr('$') == 1 return endif "preparing new window let l:tab_nr = tabpagenr('$') let l:cur_buf = bufnr('%') if tabpagenr() != 1 close! if l:tab_nr == tabpagenr('$') tabprev endif sp else close! exe "0tabnew" endif "opening current buffer in new window exe "b".l:cur_buf endfunc function MoveToNextTab() "there is only one window if tabpagenr('$') == 1 && winnr('$') == 1 return endif "preparing new window let l:tab_nr = tabpagenr('$') let l:cur_buf = bufnr('%') if tabpagenr() < tab_nr close! if l:tab_nr == tabpagenr('$') tabnext endif sp else close! tabnew endif "opening current buffer in new window exe "b".l:cur_buf endfunc
My mapping for them:
map <A-.> :call MoveToNextTab()<CR> map <A-,> :call MoveToPrevTab()<CR>
Comments
This looks like it might be promising, but you should explain better what it does, and how it's different from/why it can't use :help :tabmove or :help CTRL-W_T. --Fritzophrenic 16:06, 18 April 2008 (UTC)
One more way:
function MoveTabLeft() let current_tab = tabpagenr() if current_tab > 1 let current_tab = current_tab - 2 execute 'tabmove' current_tab endif endfunction function MoveTabRight() let current_tab = tabpagenr() execute 'tabmove' current_tab endfunction map <Leader>tl :call MoveTabLeft()<CR> map <Leader>tr :call MoveTabRight()<CR>
--Preceding unsigned comment added by 77.232.5.123 (talk • contribs) 20:44 Apr 1 2008