如何在Ruby的IRB中启用自动完成功能

问题描述:

当我使用Merb的内置控制台时,我会得到类似于标准bash提示的选项卡自动完成功能.我觉得这很有用,并希望在非Merb IRB会议上启用它.如何在IRB中获得自动完成功能?

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?

只需将require 'irb/completion'放到irbrc中即可.

Just drop require 'irb/completion' in your irbrc.

如果这不起作用,请尝试绑定, http://tagaholic.me/bond/:

If that doesn't work try bond, http://tagaholic.me/bond/:

   require 'bond'; require 'bond/completion'

债券不仅提高了irb的完成率, http://tagaholic.me/2009/07/22/better-irb-completion-with-bond.html ,但还提供了用于自定义自动填充功能的简单dsl.

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.