Read more

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

Arne Hartherz
May 09, 2022Software engineer at makandra GmbH

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

Illustration web development

Do you need DevOps-experts?

Your development team has a full backlog? No time for infrastructure architecture? Our DevOps team is ready to support you!

  • We build reliable cloud solutions with Infrastructure as code
  • We are experts in security, Linux and databases
  • We support your dev team to perform
Read more Show archive.org snapshot

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.

Posted by Arne Hartherz to makandra dev (2022-05-09 10:09)