Vim Tips Wiki
Register
Advertisement
Tip 1333 Printable Monobook Previous Next

created September 19, 2006 · complexity basic · author mz · version n/a


The default is that when you close a tab, the tab to the right of the tab you just closed becomes the current tab. This mapping closes the current tab and makes the tab to the left of the tab you just closed the current tab. I like this to provide symmetry with tabopen (new tabs go to the right of the tab you were just on). This way, if I'm editing a file, and do something quickly in a new tab, then close that tab, I get back to my original tab. Obviously the keys for the mapping can be changed to whatever you want.

noremap <silent><C-S-w> :if tabpagenr() != tabpagenr('$')<CR>:tabclose<CR>:if tabpagenr() > 1<CR>:tabprev<CR>:endif<CR>:else<CR>:tabclose<CR>:endif<CR>

Comments

Advertisement