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

Posted . Visible to the public.

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.


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.

Arne Hartherz
Last edit
Arne Hartherz
Source code in this card is licensed under the MIT License.
Posted by Arne Hartherz to makandra dev (2022-05-09 08:09)