Vim Tips Wiki
m (See your vim templates in Windows Explorer's New context menu moved to Add Vim to the Windows Explorer context menu: Page moved by JohnBot to improve title)
(Change <tt> to <code>, perhaps also minor tweak.)
 
(6 intermediate revisions by 4 users not shown)
Line 1: Line 1:
 
{{review}}
 
{{review}}
  +
{{TipImported
{{Tip
 
 
|id=640
 
|id=640
  +
|previous=639
|title=See your vim templates in Windows Explorer's New context menu
 
  +
|next=641
|created=January 20, 2004 20:17
+
|created=2004
 
|complexity=basic
 
|complexity=basic
 
|author=Mark Fernandes
 
|author=Mark Fernandes
 
|version=5.7
 
|version=5.7
 
|rating=4/3
 
|rating=4/3
  +
|category1=Windows
|text=
 
  +
|category2=
Do you wish you had your own vim settings for a file appear automatically when
 
 
}}
  +
{{deprecated|All Windows installers for Vim that I've seen will create the context menu entry for you. Make sure to 'run as admin'}}
  +
{{dodgy|What on earth is the .vtd file for?}}
 
Do you wish you had your own Vim settings for a file appear automatically when you right click in Windows Explorer? If so then read on, following these steps sequentially:
   
 
Create a template file where the last few lines control Vim. Example contents:
you right click in Windows Explorer? If so then read on, following these steps
 
   
  +
<pre>
sequentially:
 
   
 
--------------------------------End of Text----------------------------------
 
The line below controls Vim, which you can get free from: http://www.vim.org/
 
vim:tw=80:ai:ft=txt:norl:
  +
</pre>
   
  +
Call the above sample template file GVIM.vtd and save it in the "C:\Windows\ShellNew\" directory. You may use another extension, but I played it safe and used one that wasn't being used on my system. Moreover, I did not change the default location of Windows installation, but you may need to do so if your system does not match mine.
   
  +
Open Explorer and click on Tools->Folder Options. In the dialog box that appears, click on File Types and then scroll the file types until you reach VTD. Click on the file extension VTD and click on Change; now associate gvim.exe with this file extension.
- Create a template file where the last few lines control vim. See below for a
 
   
  +
Click Start, Run and enter <code>regedit</code>.
sample:
 
   
 
In the registry, scroll HKEY_CLASSES_ROOT until you get to Vim.Application
 
*Add a key called "shell".
 
*In [HKEY_CLASSES_ROOT\Vim.Application\shell] and a key called "open".
 
*In [HKEY_CLASSES_ROOT\Vim.Application\shell\open] and a key called "command".
  +
*Double click the "(Default)" value of "command" and change it to point to the location of gvim.exe on your system. I entered the following in the text field "Value data" <code>C:\PROGRA~1\Vim\vim62\gvim.exe "%1"</code>
   
 
In regedit, find HKEY_CLASSES_ROOT and scroll to ".vtd", then change the string value (Default) to <code>Vim.Application</code>
   
 
Click on [HKEY_CLASSES_ROOT\.vtd] and add a key called "ShellNew".
-[sample template file begins below this line]-
 
   
  +
Click on "ShellNew" and add a string value called "FileName". Double click on "FileName" and enter<code> GVIM.vtd</code>
   
  +
In Windows Explorer, navigate to any directory. Right click the pane displaying the files, to see "Vim" as one of your options. When you choose Vim, you will create a file called "New Vim.vtd" in that directory. When you open "New Vim.vtd" you should see the above sample text and Vim uses the settings used in the last line of the file.
   
 
Any changes made to the original template in C:\Windows\ShellNew appear in new files that you create.
--------------------------------End of Text----------------------------------
 
   
 
==Comments==
The line below controls vim, which you can get free from: http://www.vim.org/
 
  +
{{todo}}
 
  +
'''The installers don't seem to create the context menu entries on 64-bit Windows XP (and possibly other 64-bit systems.''' Maybe we should resurrect this tip? Or maybe we have another tip on this?
vim:tw=80:ai:ft=txt:norl:
 
  +
--[[User:Fritzophrenic|Fritzophrenic]] 16:12, January 3, 2012 (UTC)
 
-[sample template file ends above this line]-
 
 
 
 
- Call the above sample template file GVIM.vtd and save it in
 
 
"C:\Windows\ShellNew\" directory. You may use another extension, but I
 
 
played it safe and used one that wasn't being used on my system. Moreover, I
 
 
did not change the default location of Windows installation, but you may
 
 
need to do so if your system does not match mine.
 
 
 
 
- Open Explorer and click on Tools-&gt;Folder Options... in the dialog box that
 
 
appears, click on File Types and then scroll the file types until you reach
 
 
VTD. Click on the file extension VTD and click on Change; now associate
 
 
gvim.exe with this file extension.
 
 
 
 
- Next, open the registry with regedit by clicking on Start-&gt;Run and typing
 
 
regedit in the Run dialog box
 
 
 
 
- In the registry, scroll HKEY_CLASSES_ROOT until you get to Vim.Application
 
 
- then add a key; call it "shell"
 
 
- next scroll into:
 
 
[HKEY_CLASSES_ROOT\Vim.Application\shell]
 
 
- and add a key; call it "open"
 
 
- once more scroll into:
 
 
[HKEY_CLASSES_ROOT\Vim.Application\shell\open]
 
 
- and add yet another key; call it "command"
 
 
- now change, by double clicking on, the "(Default)" value of
 
 
"command" to point it to the location of gvim.exe on your
 
 
hard drive. On my system, I entered the following in the text
 
 
field "Value data"
 
 
C:\PROGRA~1\Vim\vim62\gvim.exe "%1"
 
 
 
 
- Finally open up Explorer and navigate to any directory on your hard drive.
 
 
Now, right click on, the pane displaying the files, to see "Vim" as one of
 
 
your options. When you choose Vim, you will create a file called "New
 
 
Vim.vtd" in that directory. When you open "New Vim.vtd" you should see the
 
 
above sample text and Vim uses the settings used in the last line of the file.
 
 
 
 
- Any changes made to the original template in C:\Windows\ShellNew appear in
 
 
the new files that you create.
 
 
 
 
I tried to get this to work with using TweakUI but that did not help in Windows
 
 
XP, so I had to do it the long way. So, I hope this tip helps at least a few of
 
 
you,
 
 
 
 
Enjoy!
 
 
 
}}
 
 
== Comments ==
 
Sorry I forgot to add this important information too...
 
- In the registry editor (Start-&gt;Run-&gt;regedit) goto HKEY_CLASSES_ROOT and then
 
scroll till you get to ".vtd" and change string value (Default) to Vim.Application
 
- next click on [HKEY_CLASSES_ROOT\.vtd]; add a key; call it "ShellNew"
 
- next click on "ShellNew" and add a String Value; call it "FileName";
 
double click on "FileName" and enter GVIM.vtd
 
 
 
Mark Fernandes
 
, January 20, 2004 20:42
 
 
----
 
----
 
You can also do without the template file.
I found this truly useful! Thanks.
 
 
It may be worth noting that one can also do without the template file.
 
In this case when right clicking on New-&gt;vim an empty file called "New Vim.vtd" is created which inherits all the setting defined in .vimrc. I find this more useful and it also simplifies the instructions.
 
 
The only changes to the instructions in this tip are
 
(1) Skip the whole creation of the file gvim.vtd
 
(2) Change the last instructions line
 
- next click on "ShellNew" and add a String Value; call it "FileName";
 
double click on "FileName" and enter GVIM.vtd
 
with - next click on "ShellNew" and add a String Value; call it "NullFile";
 
 
   
 
In this case, when right clicking on New->vim an empty file called "New Vim.vtd" is created which inherits all the setting defined in vimrc. I find this more useful and it also simplifies the instructions.
   
 
The only changes to the instructions in this tip are
 
*Skip the whole creation of the file gvim.vtd
 
*Change the instructions:
  +
:Click on "ShellNew" and add a string value called "FileName". Double click on "FileName" and enter<code> GVIM.vtd</code>
  +
*to
 
:Click on "ShellNew" and add a string value called "NullFile".
   
hugokraw--AT--gmail.com
 
, August 31, 2006 13:25
 
 
----
 
----
<!-- parsed by vimtips.py in 0.484844 seconds-->
 

Latest revision as of 05:40, 13 July 2012

Tip 640 Printable Monobook Previous Next

created 2004 · complexity basic · author Mark Fernandes · version 5.7


This tip is deprecated for the following reasons:

All Windows installers for Vim that I've seen will create the context menu entry for you. Make sure to 'run as admin'

Do you wish you had your own Vim settings for a file appear automatically when you right click in Windows Explorer? If so then read on, following these steps sequentially:

Create a template file where the last few lines control Vim. Example contents:


--------------------------------End of Text----------------------------------
The line below controls Vim, which you can get free from: http://www.vim.org/
vim:tw=80:ai:ft=txt:norl:

Call the above sample template file GVIM.vtd and save it in the "C:\Windows\ShellNew\" directory. You may use another extension, but I played it safe and used one that wasn't being used on my system. Moreover, I did not change the default location of Windows installation, but you may need to do so if your system does not match mine.

Open Explorer and click on Tools->Folder Options. In the dialog box that appears, click on File Types and then scroll the file types until you reach VTD. Click on the file extension VTD and click on Change; now associate gvim.exe with this file extension.

Click Start, Run and enter regedit.

In the registry, scroll HKEY_CLASSES_ROOT until you get to Vim.Application

  • Add a key called "shell".
  • In [HKEY_CLASSES_ROOT\Vim.Application\shell] and a key called "open".
  • In [HKEY_CLASSES_ROOT\Vim.Application\shell\open] and a key called "command".
  • Double click the "(Default)" value of "command" and change it to point to the location of gvim.exe on your system. I entered the following in the text field "Value data" C:\PROGRA~1\Vim\vim62\gvim.exe "%1"

In regedit, find HKEY_CLASSES_ROOT and scroll to ".vtd", then change the string value (Default) to Vim.Application

Click on [HKEY_CLASSES_ROOT\.vtd] and add a key called "ShellNew".

Click on "ShellNew" and add a string value called "FileName". Double click on "FileName" and enter GVIM.vtd

In Windows Explorer, navigate to any directory. Right click the pane displaying the files, to see "Vim" as one of your options. When you choose Vim, you will create a file called "New Vim.vtd" in that directory. When you open "New Vim.vtd" you should see the above sample text and Vim uses the settings used in the last line of the file.

Any changes made to the original template in C:\Windows\ShellNew appear in new files that you create.

Comments[]

 TO DO 
The installers don't seem to create the context menu entries on 64-bit Windows XP (and possibly other 64-bit systems. Maybe we should resurrect this tip? Or maybe we have another tip on this? --Fritzophrenic 16:12, January 3, 2012 (UTC)


You can also do without the template file.

In this case, when right clicking on New->vim an empty file called "New Vim.vtd" is created which inherits all the setting defined in vimrc. I find this more useful and it also simplifies the instructions.

The only changes to the instructions in this tip are

  • Skip the whole creation of the file gvim.vtd
  • Change the instructions:
Click on "ShellNew" and add a string value called "FileName". Double click on "FileName" and enter GVIM.vtd
  • to
Click on "ShellNew" and add a string value called "NullFile".