FANDOM


m (Added to Tabs category + minor reformattings)
(Change to TipImported template + severe manual clean)
Line 1: Line 1:
 
{{review}}
 
{{review}}
{{Tip
+
{{TipImported
 
|id=1333
 
|id=1333
|title=have focus on left tab after tabclose
+
|previous=1332
|created=September 19, 2006 14:25
+
|next=1334
  +
|created=September 19, 2006
 
|complexity=basic
 
|complexity=basic
 
|author=mz
 
|author=mz
 
|version=n/a
 
|version=n/a
 
|rating=12/6
 
|rating=12/6
|text=
+
}}
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.
+
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 <tt>tabopen</tt> (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.
   
 
<pre>
 
<pre>
noremap &lt;silent&gt;&lt;C-S-w&gt; :if tabpagenr() != tabpagenr('$')&lt;cr&gt;:tabclose&lt;cr&gt;:if tabpagenr() &gt; 1&lt;cr&gt;:tabprev&lt;cr&gt;:endif&lt;cr&gt;:else&lt;cr&gt;:tabclose&lt;cr&gt;:endif&lt;cr&gt;
+
noremap &lt;silent&gt;&lt;C-S-w&gt; :if tabpagenr() != tabpagenr('$')&lt;cr&gt;:tabclose&lt;cr&gt;:if tabpagenr() &gt; 1&lt;cr&gt;:tabprev&lt;cr&gt;:endif&lt;cr&gt;:else&lt;cr&gt;:tabclose&lt;cr&gt;:endif&lt;cr&gt;
 
</pre>
 
</pre>
   
  +
==Comments==
   
(I hope I'm doing this right... it's my first contribution to vim.org :) )
 
}}
 
 
== Comments ==
 
When I want to do Tab-Close with ":q" or ":wq", and ":q!", how do it?
 
 
'''Anonymous'''
 
, December 3, 2006 2:08
 
 
----
 
----
<!-- parsed by vimtips.py in 0.695564 seconds-->
 
 
 
[[Category:Tabs]]
 
[[Category:Tabs]]

Revision as of 03:41, December 31, 2007

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


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