Vim Mark That Test! 🔖
This week Chris Erin taught me a technique that has changed my testing game: Vim mark your current Ruby test with
When writing TDD-style code in a test-crazy language like Ruby, I tend to follow a predictable workflow: create a test, watch it fail, bounce around the code making changes, and run/edit the test again. This loop can repeat for hours on a complex feature.
There are many ways you could navigate back to your test from elsewhere; a very efficient method is to mark it in Vim with
mA. Like any mark, you can return to it with
`A. Why 'A'? Capitalized marks are file marks and are valid between files. With this command, you can mindlessly jump back to your test from anywhere in the jumplist stack.