Skip to content

Instantly share code, notes, and snippets.

@oelmekki
Created May 14, 2009 22:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save oelmekki/111962 to your computer and use it in GitHub Desktop.
Save oelmekki/111962 to your computer and use it in GitHub Desktop.
" File: tab_alternate.vim
" Author: Olivier El Mekki
" Email: olivier@el-mekki.com
" Description: script allow to switch to the last seen tab, as the screen C-a a
" Usage:
" :Tabalter - go to the last seen tab
if exists('tab_alternate_plugin')
finish
endif
let tab_alternate_plugin = 1
function! s:SetLastSeen()
let s:last_seen = tabpagenr()
endfunction
function! s:GetLastSeen()
silent! execute ":tabnext ". s:last_seen
endfunction
au TabLeave * call s:SetLastSeen()
command! Tabalter call s:GetLastSeen()
nnoremap <C-p> :Tabalter<CR>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment