collusioni.st

IRB History

Monday, October 23 2006

Doing a lot of work with Ruby’s IRB or a Rails app’s console? Create a file called .irbrc in your home directory with the following Ruby code and you’ll have tab completion and most importantly, input history across IRB sessions. A huge time saver.

require ‘irb/completion’
require ‘irb/ext/save-history’
ARGV.concat [ “—readline”, “—prompt-mode”, “simple” ]
IRB.conf[:SAVE_HISTORY] = 100
IRB.conf[:HISTORY_FILE] = “#{ENV[‘HOME’]}/.irb-save-history”