4/12/2023 0 Comments Open any file windowsThis means that if you are on a multi-user system, and you are the only user using Vim, other people will get very annoyed if you use these tools to make files launch in Vim. Unfortunately, all of the methods mentioned above apply your file associations in an area of the registry used by every user account in your Windows installation. This will open the file in gvim.ĭo not limit yourself to just edit actions! For example, you could make an entry to open gvim on a directory, load configuration files, or source scripts. But you can also right-click on the file, and choose "Edit" from the context menu. html file to open it in your web browser as normal. Note: in Windows XP, there is a GUI for doing this, accessible through the "Folder Options" dialog. Then, to keep the existing double-click action in place, but add Vim as the "edit" action, give the following registry key a (Default) value of "C:\Program Files\Vim\vim72\gvim.exe" "%1": HKEY_CLASSES_ROOT\htmlfile\Shell\Edit\command html files have been associated with a filetype called htmlfile. Simply replace the "open" portion of the registry key path with the desired action (in this case, "edit"). There are no easy command-line or GUI tools to do this, but you can set up other actions, such as "edit", in the same registry area that ftype uses. Although this tip has worked in the past for some people, there is no guarantee that it will work for you. WARNING: Editing your Windows registry may cause unintended side effects that render your system inoperable. This is where the registry entry created by ftype comes in. Most users would want the file to open in a web browser when double-clicking, but being able to automatically edit the file in Vim when modifying the file would be a nice thing to be able to do. html file in Vim when double-clicking the file. For most users, it would not make sense to open a. This entry could do with more inspection.Ĭonsider the. c file, Windows will see this key and look for another key to figure out what to do with a sourcecode file.įtype sourcecode="C:\Program Files\Vim\vim72\gvim.exe" "%1" will set up another registry entry, in HKEY_CLASSES_ROOT\sourcecode\Shell\Open\command with (Default) value of "C:\Program Files\Vim\vim72\gvim.exe" "%1". c=sourcecode will create a registry key at HKEY_CLASSES_ROOT\.c that has a (Default) value of sourcecode. 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.Īssoc. 3.2 Step 2: associate the filetype with gvimīoth the ftype and assoc commands work by creating entries in a specific registry location which Windows will check for various actions taken on a file. 3.1 Step 1: associate the file extension with a file type.py as "sourcecode", which it will launch in Vim as we did with PHPFile above:įtype sourcecode="C:\Program Files\Vim\vim72\gvim.exe" -remote-silent "%1" For example, the following will treat any files with extensions. You can associate any number of file extensions with a given filetype, which makes it easy to set up a single action for similar types of files. The ftype command is used to tell Windows what to do to open files of a given file type. In general, the assoc command is used to associate a given file extension with a filetype. php extension in an 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. Note: If the above commands are entered in a batch file, the percent sign must be escaped (replace "%1" with "%%1"). To use, simply open a Windows command prompt and type something like the following:įtype PHPFile="C:\Program Files\Vim\vim72\gvim.exe" -remote-silent "%1" You need to use the registry if you want to create #User-specific file associations. In order to fully specify the action to take when double-clicking a file, Windows provides the ftype and assoc command-line tools. You can use the "Open With." menu in Windows to set up a basic association, but that will not allow you to specify any command-line arguments to Vim, such as -remote-silent to open with an existing Vim instance. This "double-click to open" is commonly referred to as a "file association" and is fairly easy to set up in Microsoft Windows. Tip 1003 Printable Monobook Previous NextĪlthough the Vim installer gives you options to create right-click "edit with Vim" options, it is convenient to be able to simply double-click on a file to have it open in Vim.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |