Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Browse files

Version 6

Added tv and ts so you can open a new single tab with a split view of several files
  • Loading branch information...
1 parent 0a31d0a commit 5fb7fb6cfc15cde82ccafdc325e71eb519e1bf76 Geoff Wood committed with
Showing with 16 additions and 5 deletions.
  1. +4 −1 doc/gvimt_README.txt
  2. +12 −4 gvimt.bat
  3. BIN  gvimt.reg
5 doc/gvimt_README.txt
@@ -3,6 +3,7 @@ Written by Geoff Wood (geoffrey.wood at_symbol
gw 13/9/12 - Created
gw 25/9/12 - Updated to raise Vim to foreground, removes awk and grep dependency, adds path option to specify vim location
gw 9/10/12 - Goes to normal mode first to make sure commands execute and don't just go into the file. Waits a bit when starting vim. Clears the command from the command line afterwards.
+gw 9/5/13 adds tv and ts modes to open groups on new tab
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.
@@ -31,8 +32,10 @@ Optionally, create shortcuts in your SendTo directory with these targets:
"c:\batch files\gvimt.bat" t
"c:\batch files\gvimt.bat" v
"c:\batch files\gvimt.bat" s
+"c:\batch files\gvimt.bat" tv
+"c:\batch files\gvimt.bat" ts
-Name these three shortcuts something like "Edit with Vim Tab", "Edit with Vim VSplit" and "Edit with Vim Split"
+Name these three shortcuts something like "Edit with Vim Tab", "Edit with Vim VSplit", "Edit with Vim Split", "Edit with Vim VSplit Tab", and "Edit with Vim Split Tab"
Your SendTo menu directory location depends on which version of Windows you are using. Under XP it is probably c:\documents and settings\username\SendTo.
16 gvimt.bat
@@ -12,6 +12,7 @@ REM gw 25/9/12 uses findstr instead of grep, and direct call instead of via awk,
REM gw 27/9/12 expand to full path so can call from command line for a file in the local directory
REM also fixed typo recently introduced where vsplits were just acting as splits
REM gw 8/10/12 get into normal mode first, fixes problem where command appears in file text in insert mode
+REM gw 9/5/13 adds tv and ts modes to open groups on new tab
@@ -25,19 +26,23 @@ set already_ran=false
set vim_startup_time_ms=1000
if %1_==_ goto usage
-if /i %1 NEQ t if /i %1 NEQ v if /i %1 NEQ s goto usage
+if /i %1 NEQ t if /i %1 NEQ v if /i %1 NEQ s if /i %1 NEQ tv if /i %1 NEQ ts goto usage
REM get the short form of the batch path so don't need to use quoted form
REM further down
for %%i in (%batch_path%) do set short_batch_path=%%~si
+set task=%1
goto check_already_running
-@echo usage: gvimt [t^|v^|s] file [file2 ...]
+@echo usage: gvimt [t^|v^|s^|tv^|ts] file [file2 ...]
@echo t - open each file in new tab
@echo v - open each file in new vertical split
@echo s - echo each file in new split
+@echo tv - open new tab with files vertically split
+@echo ts - open new tab with files split
goto end
REM If run from right-click menu on multiple files
@@ -47,6 +52,8 @@ REM is running, the rest to wait for this
set already_running=false
if exist %short_batch_path%\gvimt.tmp (
+ if /i %task% EQU tv set task=v
+ if /i %task% EQU ts set task=s
set already_running=true
set already_ran=true
ping -w 100 -n 1
@@ -57,7 +64,6 @@ REM While we have this file other instances will wait
REM for us to complete
echo %2 > %batch_path%\gvimt.tmp
-set task=%1
REM If another instance ran, it made sure
@@ -81,10 +87,12 @@ if %already_ran%==false (
REM if %1_==_ goto raise_to_foreground
if %1_==_ goto end
-if /i %task% EQU t start %vim_path%gvim.exe --remote-send "<Esc>:tablast | tabe %~f1<CR>:call foreground()<CR><CR>"
+if /i %task% GEQ t if /i %task% LSS u start %vim_path%gvim.exe --remote-send "<Esc>:tablast | tabe %~f1<CR>:call foreground()<CR><CR>"
if /i %task% EQU v start %vim_path%gvim.exe --remote-send "<Esc>:vsplit %~f1<CR>:call foreground()<CR><CR>"
if /i %task% EQU s start %vim_path%gvim.exe --remote-send "<Esc>:split %~f1<CR>:call foreground()<CR><CR>"
+if /i %task% EQU tv set task=v
+if /i %task% EQU ts set task=s
goto next_file
REM This routine sort of works but its very complicated and it throws errors sometimes
BIN  gvimt.reg
Binary file not shown

0 comments on commit 5fb7fb6

Please sign in to comment.
Something went wrong with that request. Please try again.