Is there a vim command to relocate a tab?

前端 未结 7 1731
南笙
南笙 2021-01-29 18:16

How can I change the position / order of my current tab in Vim? For example, if I want to reposition my current tab to be the first tab?

7条回答
  •  不知归路
    2021-01-29 19:11

    I was looking for the same and after some posts I found a simpler way than a function:

    :execute "tabmove" tabpagenr() # Move the tab to the right
    :execute "tabmove" tabpagenr() - 2 # Move the tab to the left
    

    The tabpagenr() returns the actual tab position, and tabmove uses indexes.

    I mapped the right to Ctrl+L and the left to Ctrl+H:

    map  :execute "tabmove" tabpagenr() - 2 
    map  :execute "tabmove" tabpagenr() 
    

提交回复
热议问题