Way back in 2011, I wrote a blog post showing how to Run Tests from MacVim via Terminal.app or iTerm.app. I’ve been using that setup for years without a problem, but when iTerm2 Version 3 was released, it stopped working. I’ve updated the AppleScript and am posting it here for anyone who wants to run tests in iTerm2 (Version 3) while writing code in Vim.
I am currently working on a project that is using Cucumber for its system/integration testing, and I am using MacVim as my primary editor. MacVim comes with Tim Pope’s excellent vim-cucumber plugin pre-installed, so you get syntax highlighting of
.feature files right out of the box.
After having used TextMate to edit Cucumber features in the past I was a bit disappointed that double-quoted strings were not being highlighted in Vim. I looked around in the plugin code a bit, and the best I can tell it is only configured to highlight multi-line strings (which are triple-quoted).
For the past several weeks I have been using MacVim as my primary editor for Ruby coding. My workflow has been to edit some code, Command-Tab over to a Terminal window and run a test by either typing the command, or using the up-arrow to run the same test I had already typed in.
This worked pretty well, but it was annoying needing to type in the full path to the test file when running a new test. And I would often Command-Tab just once thinking this would take me back to a Terminal window, but end up looking at a browser forgetting that I had been reading some documentation in between test runs.