Previous TipNext Tip

Tip: #1333 - Have focus on left tab after tabclose

Created: September 19, 2006 14:25 Complexity: basic Author: mz Version: n/a Karma: 12/6 Imported from: Tip#1333

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, do something real quick 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> 

(I hope I'm doing this right... it's my first contribution to :) )


When I want to do Tab-Close with ":q" or ":wq", and ":q!", how do it?

Anonymous , December 3, 2006 2:08

Community content is available under CC-BY-SA unless otherwise noted.