This is a read-only archive!

Mmm... unit tests

I upgraded my old Ruby 1.8.2 install at work to 1.8.6 today. Thank god for unit tests. A good dozen tests of 900 failed, in the code I've churned out over the past year. If I hadn't caught the bugs all right away they would've wreaked havoc. I've learned the hard way never to upgrade anything until / unless there's a good reason to, but I had to do it to Ruby today.

In other news, today I learned the wonders of aw and iw in vim (as opposed to w). Funny how I could use vim for so long and not pick up some of these things which are so obvious and so useful. aw and iw operate on the whole word the cursor is in, forwards and backwards regardless of where in the word your cursor is. (Whereas w< goes from the current cursor position forward.) I can think of plenty of times that would've come in handy in the past. Of course there are equivalents that select sentences, the insides of quotes, blocks, paragraphs, etc., all prefixed with a and i.

June 21, 2007 @ 1:10 PM PDT
Cateogory: Programming
Tags: Ruby, Vim

3 Comments

Jason
Quoth Jason on June 21, 2007 @ 6:14 PM PDT

I'm missing something. As soon as you hit a or i, you go into input mode. The only thing either of those commands should do is put a literal 'w' one character to the right, or in the column your cursor is currently in...

I know of cw, c$, etc., but I don't understand aw/iw. Nor can I seem to get it to do anything supremely special.

Brian
Quoth Brian on June 22, 2007 @ 12:48 AM PDT

Oh, iw and aw etc. only work in Visual mode. diw, daw etc. work in Normal mode. See also :h v_a.

Jason
Quoth Jason on June 22, 2007 @ 5:58 AM PDT

Aha, Visual. I don't think I've ever entered that mode except on accident. I've certainly never used it.

Thanks.