Created
October 20, 2016 09:28
-
-
Save unclechu/c4a19b9b36997989d2ea234a6d2ffeff to your computer and use it in GitHub Desktop.
Vim: Go to previous tab after current tab closed
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function! s:PreviousTab_StoreState() | |
let s:tab_current = tabpagenr() | |
let s:tab_last = tabpagenr('$') | |
endfunction | |
function! s:PreviousTab_TabClosed() | |
if s:tab_current > 1 && s:tab_current < s:tab_last | |
exec 'tabp' | |
endif | |
endfunction | |
autocmd TabEnter,TabLeave * call s:PreviousTab_StoreState() | |
autocmd TabClosed * call s:PreviousTab_TabClosed() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment