JohnBeckett (talk | contribs) (Fix "Sent To" typo, remove incorrect reference to MS-DOS, tweak "Send To" instructions) |
(→Using Windows Send To Menu: cleaning up for clarity and adding wiki link) |
||
Line 24: | Line 24: | ||
Now, double-clicking on .c or .h files will open them in tabs in gvim. |
Now, double-clicking on .c or .h files will open them in tabs in gvim. |
||
− | ===Using Windows ''Send To'' Menu=== |
+ | ===Using Windows' ''Send To'' Menu=== |
− | Obviously, you can't enter file associations for every file you'll ever open in Vim. To provide |
+ | Obviously, you can't enter file associations for every file you'll ever open in Vim. To provide an "open in tabs" capability for files without an association, you can [[Add_Vim_to_Windows_Send_To_menu|add an entry to your "Send To" context menu]], as follows: |
#Click Start, Run then enter <tt>SendTo</tt> (you may need to enter <tt>%USERPROFILE%\SendTo</tt>). |
#Click Start, Run then enter <tt>SendTo</tt> (you may need to enter <tt>%USERPROFILE%\SendTo</tt>). |
||
− | #Click 'OK' to open |
+ | #Click 'OK' to open the SentTo directory, which contains all the shortcuts in your SendTo context menu. Add a shortcut to gvim or Vim as desired. |
− | #Edit the 'Target' box in the Properties of the gVim shortcut to read:<pre>"C:\Program Files\Vim\vim71\gvim.exe" --remote-tab-silent</pre> |
+ | #Edit the 'Target' box in the Properties of the gVim shortcut to read: <pre>"C:\Program Files\Vim\vim71\gvim.exe" --remote-tab-silent</pre> (with your own system's path to Vim, of course). |
− | In Windows Explorer, right-click one or more files, and select Send To, |
+ | In Windows Explorer, right-click one or more files, and select Send To, gvim in the context menu. You can repeat this to open other files in new tabs in the same Vim instance. |
==See Also== |
==See Also== |
Revision as of 16:47, 31 December 2007
Duplicate tip
This tip is very similar to the following:
These tips need to be merged – see the merge guidelines.
Tip: #1440 - Launch files in new tabs under Windows
Created: December 14, 2006 Complexity: basic Author: Xu Song Version: n/a Karma: 294/101 Imported from: Tip#1440
Many text editors automatically launch new files in tabs when you open them, rather than a separate window for every new file. Here's how to make Vim behave that way under Microsoft Windows.
Using File Associations
To automatically open a file in a Vim tab with a double-click or other "Open" action, you need to set up file associations. Open a command prompt window (Start, Run cmd.exe). For this example, I will use C source-code files. Modify these commands for whatever file type you want. Also, you may need to change the path to suit your system. At command prompt, type:
ftype code="C:\Program Files\Vim\vim71\gvim.exe" --remote-tab-silent "%1" assoc .c=code assoc .h=code
Now, double-clicking on .c or .h files will open them in tabs in gvim.
Using Windows' Send To Menu
Obviously, you can't enter file associations for every file you'll ever open in Vim. To provide an "open in tabs" capability for files without an association, you can add an entry to your "Send To" context menu, as follows:
- Click Start, Run then enter SendTo (you may need to enter %USERPROFILE%\SendTo).
- Click 'OK' to open the SentTo directory, which contains all the shortcuts in your SendTo context menu. Add a shortcut to gvim or Vim as desired.
- Edit the 'Target' box in the Properties of the gVim shortcut to read:
"C:\Program Files\Vim\vim71\gvim.exe" --remote-tab-silent
(with your own system's path to Vim, of course).
In Windows Explorer, right-click one or more files, and select Send To, gvim in the context menu. You can repeat this to open other files in new tabs in the same Vim instance.
See Also
- Associate_files_with_no_extension_to_Vim_under_Windows
- Make_vim_the_editor_for_files_with_unregistered_extensions_in_Windows