

h files would be opened in another instance using the code example given earlier.įtype txtfile="C:\Program Files\Vim\vim71\gvim.exe" -servername TXTVIM -remote-tab-silent "%1" txt files to be opened in an instance of gvim named TXTVIM, while. If wanted, you can define file associations so that certain file types are opened in one instance of gvim, while others are opened in a different instance.įor example, the following will cause. Using different gvim instances for different file types You can repeat this to open other files in new tabs in the same Vim instance. In Windows Explorer, right-click one or more files, and select Send To, gvim in the context menu. Edit the 'Target' box in the Properties of the gvim shortcut to read (you may need to change this for your path to gvim): "C:\Program Files\Vim\vim71\gvim.exe" -remote-tab-silent.Right-click the SendTo window and add a new shortcut to gvim. It contains the shortcuts in your Send To context menu. The SendTo directory should now be open.For Windows Vista or Windows 7 go to %APPDATA%\Microsoft\Windows\SendTo. If the Profile path for your user name has been changed, you may need to run %USERPROFILE%\SendTo rather than just SendTo. Click Start, Run then type SendTo and press Enter.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: Obviously you can't enter file associations for every file you'll ever open in Vim. To make Vim the editor for all text file types (as defined by MS Windows) tryįtype txtfile="C:\Program Files\Vim\vim72\gvim.exe" -remote-tab-silent "%1" h files will open them in tabs in a single instance of gvim.

Note: use "%%1" to execute from a batch script. At command prompt, type (you may need to change the path to suit your system):įtype code="C:\Program Files\Vim\vim72\gvim.exe" -remote-tab-silent "%1" This example uses C source-code files – modify the commands for whatever file types you want.

Open a command prompt window (Start, Run cmd.exe). To automatically open a file in a Vim tab with a double-click or other "Open" action, you need to set up file associations.

6 gvimt - script to open new files in gvim in new tabs, splits or vertical split.3 Using different gvim instances for different file types.
