Vim Tips Wiki
Register
We recommend that you log in before editing. This will allow other users to leave you a message about your edit, and will let you track edits via your Watchlist. Creating an account is quick and free.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then publish the changes below to finish undoing the edit.

Latest revision Your text
Line 20: Line 20:
 
</pre>
 
</pre>
   
'''Note:''' If the above commands are entered in a batch file, the percent sign must be escaped (replace <code>"%1"</code> with <code>"%%1"</code>).
+
('''Note: if you use these commands in a script the percent sign must be escaped like this: "%%1")'''
   
 
This particular command sequence will set up Windows to open any files with a .php extension in an [[Launch_files_in_new_tabs_under_Windows|existing gvim window]] (or it will open new gvim window if there is no already opened gvim window).
 
This particular command sequence will set up Windows to open any files with a .php extension in an [[Launch_files_in_new_tabs_under_Windows|existing gvim window]] (or it will open new gvim window if there is no already opened gvim window).
Line 31: Line 31:
 
assoc .pl=sourcecode
 
assoc .pl=sourcecode
 
assoc .py=sourcecode
 
assoc .py=sourcecode
ftype sourcecode="C:\Program Files\Vim\vim72\gvim.exe" --remote-silent "%1"
+
ftype sourcecode="C:\Program Files\Vim\vim72\gvim.exe" --remote-silent "%%1"</pre>
 
('''Note: if you use these commands in a script the percent sign must be escaped like this: "%%1")'''
</pre>
 
 
'''Note:''' If the above commands are entered in a batch file, the percent sign must be escaped (replace <code>"%1"</code> with <code>"%%1"</code>).
 
 
 
==How it works==
 
==How it works==
 
Both the <code>ftype</code> and <code>assoc</code> commands work by creating entries in a specific registry location which Windows will check for various actions taken on a file. The easiest and safest way to create these entries is to use the command-line tools, but it is possible to create them by hand.
 
Both the <code>ftype</code> and <code>assoc</code> commands work by creating entries in a specific registry location which Windows will check for various actions taken on a file. The easiest and safest way to create these entries is to use the command-line tools, but it is possible to create them by hand.
Line 167: Line 164:
 
Perhaps [[Associate files with no extension to Vim under Windows|Tip 1301]] could be merged in here, by adding
 
Perhaps [[Associate files with no extension to Vim under Windows|Tip 1301]] could be merged in here, by adding
 
:<code>assoc .=sourcecode</code>
 
:<code>assoc .=sourcecode</code>
to the examples, with a comment saying it applies to a file with no extension?
+
to the examples, with a comment syaing it applies to a file with no extension?
   
 
[[User:JLittle|JLittle]] 21:27, November 10, 2009 (UTC)
 
[[User:JLittle|JLittle]] 21:27, November 10, 2009 (UTC)
Please note that all contributions to the Vim Tips Wiki are considered to be released under the CC-BY-SA
Cancel Editing help (opens in new window)