Shell-style History for IRB

October 21st, 2006

A little bit later this afternoon, I’m going to be giving a lightning talk on adding shell-style history commands to irb. Essentially, it adds the ability to inspect your history and re-execute lines from the history.

In order for this to work properly, you’ll need to have one of the various irb history hacks running. An easy option is wirble, or you can go the traditional route and use Michael Granger’s hack from the RubyGarden wiki.

Both of those, in one way or another, try to remove duplicate entries from your history. Wirble does it wrong (doesn’t reverse first so you keep the first instead of the latest), but Michael’s version does it right. That said, I disabled the uniq entirely because I don’t want it. The hack above will work better without it.

I’ll post more information and some examples later, when the internets are less flaky. In the meantime, hit up this page and drop that code in your ~/.irbrc. Enjoy!

1 Response to “Shell-style History for IRB”

  1. Brian Ehmann Says:

    Works great!!! Thanks

Sorry, comments are closed for this article.