From 465b81ea179dc1fd62767ea69fb23432dce50d0c Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Fri, 30 May 2014 23:56:11 -0400 Subject: vimrc: add tl to go to last active tab Makes it easier to switch between two tabs when there are a bunch open. Instead of having to memorize their tab numbers, just use this command. Taken from http://stackoverflow.com/questions/2119754/switch-to-last-active-tab-in-vim --- vimrc | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/vimrc b/vimrc index 4443630..2b6a861 100644 --- a/vimrc +++ b/vimrc @@ -181,6 +181,8 @@ " than the odd ones). Originally I thought it was distracting but I " just caved. Much easier to follow the line when it gets really long " if it's a different colour than its neighbors. +" * Add a leader command to go to the last active tab. Make it easier to +" back and forth between tabs. " @@ -465,6 +467,15 @@ nnoremap tn :tabnew " Delete buffer and go to previous tab nnoremap tx :bdelete \| normal! gT +" Go to last viewed tab +" http://stackoverflow.com/a/2120168 +let g:last_viewed_tab = 1 +augroup last_viewed_tab + autocmd! + autocmd TabLeave * let g:last_viewed_tab = tabpagenr() +augroup END +nnoremap tl :execute "tabnext " . g:last_viewed_tab + " Quickfix nnoremap ]q :cnext nnoremap [q :cprevious -- cgit v1.2.3