Vim Tips Wiki
(Change <tt> to <code>, perhaps also minor tweak.)
 
(3 intermediate revisions by 2 users not shown)
Line 4: Line 4:
 
|previous=1202
 
|previous=1202
 
|next=1204
 
|next=1204
|created=April 16, 2006
+
|created=2006
 
|complexity=basic
 
|complexity=basic
|author=Anon
+
|author=
 
|version=5.7
 
|version=5.7
 
|rating=13/7
 
|rating=13/7
Line 15: Line 15:
   
 
<pre>
 
<pre>
map &lt;F12&gt; &lt;ESC&gt;:Tlist&lt;CR&gt;^Wh^Ws:VTreeExplore&lt;CR&gt;:set nonu&lt;CR&gt;^Wl
+
map <F12> <Esc>:Tlist<CR><C-W>h<C-W>s:VTreeExplore<CR>:set nonu<CR><C-W>l
 
</pre>
 
</pre>
 
Be sure to enter the ^W's as CTRL-V CTRL-W.
 
   
 
The mapping does the following:
 
The mapping does the following:
Line 28: Line 26:
   
 
==Comments==
 
==Comments==
  +
Not sure if Tlist and VTreeExplore can be used with <code>|</code>, but consider (untested):
I'm new to Vim so maybe I missed something, but I didn't get it working before I wrote:
 
 
<pre>
 
<pre>
map &lt;F12&gt; &lt;ESC&gt;:Tlist&lt;CR&gt;&lt;C-W&gt;h &lt;C-W&gt;s:VTreeExplore&lt;CR&gt;:set nonu&lt;CR&gt;&lt;C-W&gt;l
+
map <F12> <Esc>:Tlist <Bar> wincmd h <Bar> wincmd s <Bar> VTreeExplore <Bar> set nonu <Bar> wincmd l<CR>
 
</pre>
 
</pre>
  +
  +
{{help|:wincmd}}
  +
  +
Also consider using 'nnoremap' and 'inoremap' and possibly 'vnoremap' rather than just 'map'.

Latest revision as of 06:13, 13 July 2012

Tip 1203 Printable Monobook Previous Next

created 2006 · complexity basic · version 5.7


A simple mapping to quickly set up a couple of VTreeExplorer and TagList in the left side of your Vim window. Add the following to your vimrc:

map <F12> <Esc>:Tlist<CR><C-W>h<C-W>s:VTreeExplore<CR>:set nonu<CR><C-W>l

The mapping does the following:

  • Opens the TagList (opens left by default).
  • Switches to the TagList window and splits it.
  • Opens VTreeExplorer in the split window.
  • Turns of line numbering in the VTreeExplorer.
  • Switches back to the window where you started.

Comments[]

Not sure if Tlist and VTreeExplore can be used with |, but consider (untested):

map <F12> <Esc>:Tlist <Bar> wincmd h <Bar> wincmd s <Bar> VTreeExplore <Bar> set nonu <Bar> wincmd l<CR>

:help :wincmd

Also consider using 'nnoremap' and 'inoremap' and possibly 'vnoremap' rather than just 'map'.