How to Enable Auto Completion in Ruby's Irb

How to enable auto completion in Ruby's IRB

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.

Disable irb autocomplete

Try putting this in your ~/.irbrc

IRB.conf[:USE_AUTOCOMPLETE] = false

How to enable irb tab completion in jruby

It's a bug with JRuby 1.7.0 - in JRuby 1.6.8 the tab completion worked fine once I did require 'irb/completion'

logged the bug under http://jira.codehaus.org/browse/JRUBY-6996

How to turn on the Autocomplete mode in irb mode?

Put in your config something like:

 (defun my-inf-ruby-mode-hook ()
(set (make-local-variable 'ac-auto-start) 2)
(set (make-local-variable 'ac-auto-show-menu) t)
)
(add-hook 'inf-ruby-mode-hook 'my-inf-ruby-mode-hook)

And I think, that you'll also need to setup ac-sources variable in this hook, so it will use ruby dictionaries...

In Emacs irb (inferior-ruby-mode), how to make Autocomplete honor words from Ruby mode buffers?

look to ac-source-words-in-same-mode-buffers... We can re-use this approach to build our own completion sources, for example:

 (ac-define-source words-in-ruby-buffers
'((init . ac-update-word-index)
(candidates . (ac-word-candidates
(lambda (buffer)
(eq (buffer-local-value 'major-mode buffer) 'ruby-mode))))))

will give us ac-source-words-in-ruby-buffers completion source.

P.S. I hadn't tested it, but it should work ;-)

Tab completion for methods in irb, which method is used?

Completion in IRb is provided by the irb/completion standard library, which is unfortunately undocumented. You can find the source for the case you are interested in here: https://GitHub.Com/Ruby/Ruby/blob/trunk/lib/irb/completion.rb#L149-195

Disabling irb autocomplete on Heroku

Your application's root directory ends up being the application's user's home directory at Heroku so you could put a .irbrc in your application's root directory. So add your .irbrc with IRB.conf[:USE_AUTOCOMPLETE] = false to your app's root directory so that it looks like this:

$ cd your_app_root_directory
$ ls -1A
.git/
...
.irbrc # <-----------------
...
Gemfile
Gemfile.lock
Procfile
README.md
Rakefile
app/
bin/
config/
config.ru
db/
...

Then, once you push everything up to Heroku, heroku run console will use that .irbrc.



Related Topics



Leave a reply



Submit