Compiling vim with Ruby on Windows

My favorite text editor is Vim even on Microsoft Windows (which am I forced to use sometimes at work). I also like the Lusty plugin. This plugin is written in Ruby.

And that’s the problem. Vim on Windows is compiled with dynamic Ruby support. Which means that Vim loads the Ruby library at runtime, if it’s available. So Vim ships without Ruby and if you install it, it can use it. So the theory. In practice, that works well with other scripting languages like Python or Tcl. But Ruby seems to change its ABI very often. On Linux, everything is compiled by the distribution, so everything fits together.

At the result I was unable to find a suitable Ruby for the binary distribution of Vim. So I compiled my own Vim in MinGW. I tried Visual Studio, but that’s much more complicated.

So here are the steps to compile Vim with proper Ruby support:

  1. Download and install MinGW with following packages:
    • mingw-base
    • developer-tools
    • msys-base
    • msys-gcc-c++
  2. Download and install Ruby. I’m using „2.0.0 p364 (x86)“. The important thing is that it’s the 32 bit version, not the 64 bit version.
  3. Download and install Mercurial.
  4. Add c:\mingw\bin to the %PATH%.
  5. Add c:\mingw\bin to the %PATH%.
  6. Now change into the vim directory you just cloned and execute in the src subdirectory
    the build commands
    c:\> make -f Make_ming.mak RUBY=c:\\ruby200 RUBY_VER=20 RUBY_VER_LONG=2.0.0 GUI=no
    c:\> make -f Make_ming.mak RUBY=c:\\ruby200 RUBY_VER=20 RUBY_VER_LONG=2.0.0
    This will produce a vim.exe and gvim.exe.
  7. Now just copy the executables in the already installed program files directory of vim and enjoy your vim with Ruby support!
Dieser Beitrag wurde unter Programming, Windows veröffentlicht. Setze ein Lesezeichen auf den Permalink.

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert.