VimGolf is a “competition” to see how efficiently you can format a text document using as few vim keystrokes as possible. I was interested in participating to hone my Vim skills and to get a guage as to how effective they are compared to others.
However, I quickly found installing VimGolf on Windows is not highly documented. Here’s what I did. I hope this helps you if you’re having trouble getting started.
- Install vim. I’m using the 64bit version. After it’s installed, open cmd (Start -> Run -> cmd) and type vim. If it launches you’re good to go (skip to step two). This didn’t work for me. If this happens to you, go to Control Panel -> System and Security -> System -> Advanced system settings and click on the Environment Variables button. Scroll down the system variables box until you find PATH. Highlight it and click edit. Add the path to your Vim program files. Restart the cmd and try launching again by typing vim.
- You will also need diff installed. Diff compares two files to see what is different. This is how the VimGolf script will know if you succeeded in completing a challenge. So check that diff is installed and accessible via the command line by typing diff. If you get the error “diff: missing operand” you are good. If not, check this discussion on how to get it installed.
- Install Ruby. I did the simple install from here. I didn’t mess with any options. Just double click the installer and go.
- Relaunch cmd and type: gem install vimgolf
You should see ruby kick in and start downloading packages. It will have to download and install a few dependencies. This will all happen in the cmd terminal and you won’t have to do anything. - In the cmd window, type: vimgolf setup
You will be prompted to enter your VimGolf key. This is assigned to you when you create your VimGolf account (create one now if you haven’t already). Copy the key and right click in the cmd window and select paste. You should get a confirmation that you are set. - Choose a VimGolf challenge by clicking on the title of one. The page that comes up will have the challenge id in the black box on the right of the screen. It will be the last line. Something like: vimgolf put 4d4bc8512e218a370300001c
Paste that into your cmd window and vim should start up with the problem text loaded. - Once you have the problem solved, :wq out of vim. The VimGolf script will compare your solution to the answer using the installed diff. If you are successful, you will see a score. Reload the vimgolf challenge page to see your ranking on that problem. If you didn’t get it right, try again.
That worked for me. Experience tells me that it will either go very smoothly for you or you will be pulling out your hair trying to get some broken piece to work. Good luck. Let me know if I got something wrong. Happy viming.