Building and Installing gVim on Windows 8.1 Pro

Vim (most often gVim, but I am fine in the terminal as well) is the only editor that I am really used to using. So, when I installed Windows 8.1 on my trusty old laptop, I immediately wanted to build a brand spanking new 64-bit version (yeah, and this thing can't deal with 2x2GB properly, but why not?) with all the latest patches. That means, building from source. When I had XP SP3 on this thing, I had set up nice little environments for building every little thing I liked to build from source. On this new OS which really, desperately wants to run on a phone, I did not know how things were going to work (I have heard that things were even worse with 8.0).

After a few false starts (such as trying to do this with Visual Studio 2013 Express Edition for Windows Desktop), I realized the right tool to use is the Windows SDK 7.1.

I installed TortoiseHG and cloned the source:

I realize, green just is not my color … I seriously miss the way you could customize the GUI in XP. But, I digress …

Vim comes with a makefile, Make_mvc.mak for Microsoft's compiler. I noticed the cl that came with SDK 7.1 supported an optimization option called /favor:INTEL64, so I added that to the OPTFLAG variable right around line 481 and entered:

C:\…\vim\src> nmake -f Make_mvc.mak OPTIMIZE=SPACE CPU=AMD64 NETBANS=no GETTEXT=no GUI=yes

And, within about 30 seconds, the executable was built.

What now?

The file INSTALLpc.txt has a lot of information, and tells you what you need to do next, in section 10, at the end of the file:

C:\…\vim\src> mkdir c:\opt\vim\vim74

C:\…\vim\src> copy *.exe c:\opt\vim\vim74
gvim.exe
install.exe
uninstal.exe
vimrun.exe
        4 file(s) copied.

C:\…\vim\src> copy GvimExt\gvimext.dll c:\opt\vim\vim74
        1 file(s) copied.

C:\…\vim\src> copy xxd\xxd.exe c:\opt\vim\vim74
        1 file(s) copied.

C:\…\vim\src> xcopy ..\runtime\* c:\opt\vim\vim74 /e

Then I changed my directory to c:\opt\vim\vim74, and typed install. You get a funky text based menu where you enter item numbers to select and toggle options. I think this is what they call old school, but then I grew up with it, but I admit it might be daunting at first:

Originally, I had made a mistake, and staged the vim74 directory in %temp%. I promptly realized I had made a mistake: I needed those files in a better place, not in my %temp%. I moved the vim74 directory to c:\opt\vim\vim74, and typed install again.

I really don't want those batch files. So, I typed the digit 1 and pressed enter. The program listed a bunch of directories in my %path% giving me the option to create batch files in one of those directories. The last option, in my case 12, was not to create any batch files, and that's the one I went with.

I am also trying to be a disciplined Vim user, so I disabled the mapping of CTRL-C, CTRL-V … etc in the default _vimrc to be created. Of course, I had saved my trusted _vimrc, and that's going in my %userprofile% directory.

Finally, I disabled the creation of various icons on the desktop:

Finally, type d, press Enter, and there you have your "Edit with Vim" context-menu entry.

Hope this helps!

PS: If you also want vim.exe for console use, do an nmake -f Make_mvc.mak … GUI=yes clean and then repeat the nmake command without GUI=yes. You can simply copy the resulting vim.exe alongside gvim.exe.