About

Vsgvim is a program which allows you to use VIM as your View Source application within Internet Explorer.

I have made both the MSI (which you can double-click on to install) and the source code to everything available under a BSD-style copyright. Compiling the source will require the Platform SDK and Visual C++ to be installed.

Release News

  • 1.0: First public release.

Download

How It Works

Internet Explorer allows end users to customize which application they wish to use system-wide when they click Source in the View menu by setting a registry key. Specifically, IE looks for the value of the default key in HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\View Source Editor\Editor Name for the path of the application; if it cannot find this application, it launches Notepad (the default).

A tiny problem exists, however. Internet Explorer creates a temporary file with the contents of the HTML and then gives the name of that file to the View Source application. However, when it invokes the application, it doesn’t handle spaces correctly; instead of passing the file as one argument with spaces in it, it passes it as multiple arguments, delimited by spaces. Apparently Notepad internally rejoins all its arguments together with spaces when it is invoked this way.

Therefore, I wrote a little application which solves this, along with a few other problems (such as telling gvim the file is HTML and read-only), and then invokes gvim with the fixed arguments. It obtains the location of gvim by looking at the value of path in the registry key HKEY_LOCAL_MACHINE\SOFTWARE\Vim\Gvim, which should be set by recent installations of gvim. After I was done with this, I wrapped it in the Windows Installer to make installing it as easy as double-clicking. The installer will double-check to make sure it can find gvim and will refuse to install if it cannot.