One thing I love about Ruby (and really miss when working in Java) is its interactive command line interpreter irb (or script/console if you’re using Rails). I really wish irb had tab completion and saved history configured by default out of the box. The good news is it’s easy to configure by creating a $HOME/.irbrc file with the following contents:
require 'irb/completion' ARGV.concat [ "--readline", "--prompt-mode", "simple" ] IRB.conf[:EVAL_HISTORY] = 1000 IRB.conf[:SAVE_HISTORY] = 1000 IRB.conf[:HISTORY_FILE] = File::expand_path("~/.irbhistory")
Now when I fire up irb or script/console I get full readline support including tab completion (for example type Time:: and hit tab), reverse command search (control-R), and saved command history so when I exit and restart my command history is still there!
amazing… after 30 or so articles on how to compile readline into ruby, this fixed my issue with script/console not loading readline.
Pingback: Ruby Brasil - » irb: histÃ³rico e tecla ‘tab’ para completar comandos
I use ruby on rails on linux SUSE 10.1 and script/console failed to launch with an error loading readline. With your file, all is OK now.