When we use vim in windows, we often choose "Edit with Vim" from the context menu to open the file. However, files opened in this way will be opened in the new window, rather than in a new tab like Ultra Edit.
VIM 7.0 already supports tabs. How can I create a new tag instead of a new window when opening a file? The following VBScript implements this function by modifying the registry. Don't worry, it won't damage your registry.
Save the following content to a file named vim. vbs:
Option Explicit 'forces the display of declared variables.
On Error Resume Next 'do not handle errors
Dim WSHShell
Set WSHShell = WScript. CreateObject ("WScript. Shell ")
WSHShell. RegDelete "HKEY_CLASSES_ROOT" * "OpenWithList" gvim.exe ""
WSHShell. RegDelete "HKEY_CLASSES_ROOT" * "shellex" ContextMenuHandlers "gvim ""
WSHShell. RegDelete "HKEY_CLASSES_ROOT" * "Shell" edited with & Vim ""
WSHShell. RegDelete "HKEY_CLASSES_ROOT" * "Shell" Edit with Vim ""
Dim gvimpath
Gvimpath = WSHShell. RegRead ("HKEY_LOCAL_MACHINE" SOFTWARE "Vim" Gvim "path ")
WSHShell. RegWrite "HKEY_CLASSES_ROOT" * "Shell" Edit with Vim "", "With Vim (& F )"
WSHShell. RegWrite "HKEY_CLASSES_ROOT" * "Shell" Edit with Vim "command "",_
Chr (34) + gvimpath + Chr (34) + "-p -- remote-tab-silent" + _
Chr (34) + "% 1" + Chr (34), "REG_SZ"
Next, double-click the vim. vbs file.
OK. Now you can right-click the file you want to open and see the "Edit with Vim" item? Select this option to open the file on a new Vim tab.