tags:

views:

81

answers:

2

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 last active line. Plugins / keyboard mappings / voodoo all acceptable.

+1  A: 

Put this in your .vimrc:

let g:lasttab = 1
nmap <Leader>tl :exe "tabn ".g:lasttab<CR>
au TabLeave * let g:lasttab = tabpagenr()

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

Lucas Oman
that is awesome, thanks so much
Paul
A: 

I use buffers and not tabs, but I am able to switch between the current and latest used buffer using :b#
Basics of using buffers are:
:e filename to open file in new buffer
:bn to go to next buffer
:bp to go to previous buffer
:bd to close current buffer

Pierre