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
Fix the potential issue when a tab is closed:
" Switch to last-active tab
if !exists('g:Lasttab')
let g:Lasttab = 1
let g:Lasttab_backup = 1
endif
autocmd! TabLeave * let g:Lasttab_backup = g:Lasttab | let g:Lasttab = tabpagenr()
autocmd! TabClosed * let g:Lasttab = g:Lasttab_backup
nmap ` :exe "tabn " . g:Lasttab