From 9aa18f61f297fcb2ee0cbd4be0772607745274b7 Mon Sep 17 00:00:00 2001 From: Stan Lo Date: Tue, 6 Dec 2022 00:53:28 +0000 Subject: [ruby/irb] Allow disabling autocompletion with `IRB_USE_AUTOCOMPLETE=false` (https://github.com/ruby/irb/pull/469) * Allow using IRB_USE_AUTOCOMPLETE=false to disable autocompletion Currently, the only 2 ways to disable autocompletion are: 1. Create `.irbrc` and set `IRB.conf[:USE_AUTOCOMPLETE] = false` 2. Add the `--noautocomplete` flag when using the `irb` executable Both of them are less convenient than setting a env var and are lesser known to devs. And given the number of problems the autocompletion has (see #445), I think we should allow disabling it with a simple `IRB_USE_AUTOCOMPLETE=false`. * Mention some env var configs in the README --- lib/irb/init.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/irb/init.rb b/lib/irb/init.rb index dd888f3727..55453cc8f7 100644 --- a/lib/irb/init.rb +++ b/lib/irb/init.rb @@ -45,7 +45,7 @@ module IRB # :nodoc: @CONF[:USE_SINGLELINE] = false unless defined?(ReadlineInputMethod) @CONF[:USE_COLORIZE] = (nc = ENV['NO_COLOR']).nil? || nc.empty? - @CONF[:USE_AUTOCOMPLETE] = true + @CONF[:USE_AUTOCOMPLETE] = ENV.fetch("IRB_USE_AUTOCOMPLETE", "true") != "false" @CONF[:INSPECT_MODE] = true @CONF[:USE_TRACER] = false @CONF[:USE_LOADER] = false -- cgit v1.2.3