Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Tag: 1
Fetching contributors…

Cannot retrieve contributors at this time

33 lines (20 sloc) 2.187 kB
This is a mirror of
Written by Geoff Wood (geoffrey.wood at_symbol
gw 13/9/12 - created
gvimt.bat is a script for Windows to open new files in gvim in new tabs, splits or vertical splits. It starts gvim if it is not running already.
Call it from SendTo menu, from Context menu entries or from the command line.
It needs gvim.exe, grep and awk in the path (tested with gnu versions).
It uses the tasklist command (which exists from Windows XP, but not in Windows 2000) when checking if gvim is already running. On Windows 2000 you\\&#039ll need to have an instance of gvim running already.
It creates gvimt.tmp while it is running, if it crashes or goes wrong for some reason, delete this file.
Why use this instead of simpler methods?
There are simpler ways to call gvim directly passing file names to new tabs. There is the --remote-tab parameter, for example. Some methods are discussed here:
There are some problems doing this with many files from the Windows context menu:
- There is no --remote-split parameter so a different approach is needed for opening files in a new split window. --remote-send can be used to send an arbitary command for this, but unlike --remote-tab it will not open a new instance of gvim if one doesn\\&#039t already exist.
- If you select multiple files and use the Windows context menu, each file gets its own invocation of the command. gvim does not handle several simultaneous --remote-tab commands well.
- The SendTo menu does pass all the selected files to one command, but it is an extra click on the right menu to get there, so it is nice to use the Context menu.
Why use awk, tasklist and grep?
Calling vim directly from a batch file has problems with backslashes in the target file path vanishing. The simplest approach is just to use something else to call gvim that doesn\\&#039t mangle the path, I use awk for this sort of thing.
grepping the tasklist is an easy way to see if gvim is already running.
Jump to Line
Something went wrong with that request. Please try again.