Posted 5 months ago. Visible to the public.

IRB's multi-line autocomplete and how to disable it

Recent IRB versions include a multi-line autocomplete which may be helpful to novice users but can be distracting.

Cycling through options works by pressing the Tab key (as usual), and for some methods you also get some kind of documentation, though the quality of results is usually not on par with your IDE of choice.

I have found that it also slows down my IRB in some cases, or that pressing the Backspace key does not always reliably remove characters, which I find more annoying than useful.

You may disable multi-line autocomplete by

  • using the --nomultiline commandline switch (for Rails, use bin/rails console -- --nomultiline), or
  • specifying IRB.conf[:USE_MULTILINE] = false in your ~/.irbrc.

Demo

Note that this disables IRB's multiline cursor navigation. If you like it, you have to pick your poison.

Also note: even when multiline autocomplete is disabled, autocomplete itself (by pressing the Tab key) will still work.
You could use --noautocomplete or IRB.conf[:USE_AUTOCOMPLETE] = false to disable autocompletion in general, but I don't recommend doing that.

Does your version of Ruby on Rails still receive security updates?
Rails LTS provides security patches for unsupported versions of Ruby on Rails (2.3, 3.2, 4.2 and 5.2).

Owner of this card:

Avatar
Arne Hartherz
Last edit:
5 months ago
by Arne Hartherz
Attachments:
irb-multiline-autocomplete.gif
About this deck:
We are makandra and do test-driven, agile Ruby on Rails software development.
License for source code
Posted by Arne Hartherz to makandra dev
This website uses short-lived cookies to improve usability.
Accept or learn more