FANDOM


(adding category)
(merge in content from VimTip279)
 
(6 intermediate revisions by 3 users not shown)
Line 1: Line 1:
{{Tip
+
{{TipImported
 
|id=1301
 
|id=1301
|title=In Windows, associate files with no extension to vim
+
|previous=1300
|created=August 10, 2006 17:36
+
|next=1302
  +
|created=2006
 
|complexity=basic
 
|complexity=basic
 
|author=John Little
 
|author=John Little
 
|version=5.7
 
|version=5.7
 
|rating=87/32
 
|rating=87/32
|text=
+
|category1=File Handling
  +
|category2=Windows
 
}}
 
}}
  +
For Windows users that use [[Windows file associations]] to [[Launch_files_in_new_tabs_under_Windows|automatically launch files in Vim]], a gem I've found is, in a command prompt window:
   
For Windows users that use file associations to [[Launch_files_in_new_tabs_under_Windows|automatically launch files in Vim]], a gem I've found is, in a command window (aka DOS) prompt:
+
<pre>
  +
assoc .=txtfile
  +
</pre>
   
assoc .=txtfile
+
Where txtfile has been defined as a file type that is opened with Vim. See [[VimTip1003]], and try <code>ftype /?</code> at the command prompt.
 
(or something else that is opened with vim; see [[VimTip1003]], and be aware of the "ftype" command).
 
   
 
This will cause files with no extension (e.g. "Makefile") to open automatically in Vim.
 
This will cause files with no extension (e.g. "Makefile") to open automatically in Vim.
   
== Comments ==
+
You may need to logout and log back in before this will take effect.
  +
  +
{{RegistryWarning}}
  +
You can also use the Windows Registry to set up the extensionless file association. For example, by importing the following registry file (adjust for correct Vim version):
  +
  +
<pre>
  +
Windows Registry Editor Version 5.00
  +
[HKEY_CLASSES_ROOT\.]
  +
[HKEY_CLASSES_ROOT\.\shell]
  +
[HKEY_CLASSES_ROOT\.\shell\open]
  +
[HKEY_CLASSES_ROOT\.\shell\open\command]
  +
@="\"C:\\Vim\\vim61\\gvim.exe\" \"%1\""
  +
</pre>
   
  +
==See also==
  +
*[[VimTip279]] for automatically launching Vim for files which may have an extension but have no file association.
   
[[Category:Windows]]
+
==Comments==
[[Category:File Handling]]
 

Latest revision as of 16:57, November 12, 2012

Tip 1301 Printable Monobook Previous Next

created 2006 · complexity basic · author John Little · version 5.7


For Windows users that use Windows file associations to automatically launch files in Vim, a gem I've found is, in a command prompt window:

assoc .=txtfile

Where txtfile has been defined as a file type that is opened with Vim. See VimTip1003, and try ftype /? at the command prompt.

This will cause files with no extension (e.g. "Makefile") to open automatically in Vim.

You may need to logout and log back in before this will take effect.

WARNING: Editing your Windows registry may cause unintended side effects that render your system inoperable. Although this tip has worked in the past for some people, there is no guarantee that it will work for you. Use with caution, and at your own risk.

You can also use the Windows Registry to set up the extensionless file association. For example, by importing the following registry file (adjust for correct Vim version):

Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\.]
[HKEY_CLASSES_ROOT\.\shell]
[HKEY_CLASSES_ROOT\.\shell\open]
[HKEY_CLASSES_ROOT\.\shell\open\command]
@="\"C:\\Vim\\vim61\\gvim.exe\" \"%1\""

See alsoEdit

  • VimTip279 for automatically launching Vim for files which may have an extension but have no file association.

CommentsEdit

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