When I use Merb's built in console, I get tab auto-completion similar to a standard bash prompt. I find this useful and would like to enable it in non-merb IRB sessions. How do I get auto-completion in IRB?
A:
Check out this page for instructions
http://www.sufixo.com/raw/2006/05/29/tip_ruby_irb_auto-complete/
Cody Caughlan
2009-09-05 00:32:58
A:
This is just repeating the information on Cody Caughlan's comment above so it is easier to find:
either require 'irb/completion'
or add the following to ~/.irbrc
IRB.conf[:AUTO_INDENT] = true
IRB.conf[:USE_READLINE] = true
IRB.conf[:LOAD_MODULES] = [] unless IRB.conf.key?(:LOAD_MODULES)
unless IRB.conf[:LOAD_MODULES].include?('irb/completion')
IRB.conf[:LOAD_MODULES] << 'irb/completion'
end
John F. Miller
2009-09-05 01:58:27
"the page above" is a little confusing, as the order of answers can be changed. You may wish to refer to answers by the author of those answers.
Andrew Grimm
2009-09-07 05:51:34
Why should I add this block to the ibrc if a simple require statement does the same?
maxschlepzig
2010-10-27 17:06:07
+3
A:
Just drop require 'irb/completion' in your irbrc.
If that doesn't work try bond, http://tagaholic.me/bond/:
require 'bond'; require 'bond/completion'
Bond not only improves irb's completion, http://tagaholic.me/2009/07/22/better-irb-completion-with-bond.html, but also offers an easy dsl for making custom autocompletions.