:tabm[ove] [N] *:tabm* *:tabmove*
Move the current tab page to after tab page N. Use zero to
make the current tab page the first one. Without N the tab
page is made the last one.
我有两个键绑定,将当前选项卡向左或向右移动。非常方便!
这是我的VIM宏。我不是一个很大的ViM编码器,所以也许它可以做得更好,但这就是它对我的工作方式:
" Move current tab into the specified direction.
"
" @param direction -1 for left, 1 for right.
function! TabMove(direction)
" get number of tab pages.
let ntp=tabpagenr("$")
" move tab, if necessary.
if ntp > 1
" get number of current tab page.
let ctpn=tabpagenr()
" move left.
if a:direction < 0
let index=((ctpn-1+ntp-1)%ntp)
else
let index=(ctpn%ntp)
endif
" move tab page.
execute "tabmove ".index
endif
endfunction
:tabm[ove] [N] *:tabm* *:tabmove*
Move the current tab page to after tab page N. Use zero to
make the current tab page the first one. Without N the tab
page is made the last one.