Switch to last-active tab in VIM

前端 未结 4 2000
生来不讨喜
生来不讨喜 2021-01-31 03:01

In Vim, is there a way to quickly toggle between the current tab and the last-active tab? Sort of the way \'\' toggles between the current line and the las

4条回答
  •  臣服心动
    2021-01-31 03:17

    Put this in your .vimrc:

    if !exists('g:lasttab')
      let g:lasttab = 1
    endif
    nmap tl :exe "tabn ".g:lasttab
    au TabLeave * let g:lasttab = tabpagenr()
    

    Then, in normal mode, type \tl to swap to the tab you viewed last.

提交回复
热议问题