# IRB tab-completion fails for directories in ruby 0.9.1

**URL:** <https://www.ruby-forum.com/t/irb-tab-completion-fails-for-directories-in-ruby-0-9-1/176099>\
**Category:** Ruby\
**Created:** [September 24, 2009, 8:33pm UTC](https://www.ruby-forum.com/t/irb-tab-completion-fails-for-directories-in-ruby-0-9-1/176099 "2009-09-24T20:33:47Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![sclarke](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/b19c9b/32.png) [@sclarke](https://www.ruby-forum.com/u/sclarke)\
**Post date:** [September 24, 2009, 8:33pm UTC](https://www.ruby-forum.com/t/irb-tab-completion-fails-for-directories-in-ruby-0-9-1/176099/1 "2009-09-24T20:33:47Z")

</div>

I recently upgraded from Ruby 0.8.6 to 0.9.1, and was trying out some  
old scripts to make sure they worked. The scripts were typically run in  
IRB and performed some calculations with data saved in a networked  
drive. Because the scripts are stored on my local computer I would have  
to navigate over to the drive by doing something like:  
“ScriptName.action ‘Z:/directory/filename.bin’”. In 0.8.6 I was able to  
enter that filepath through tab completion, but this no longer works.

After trying to debug this problem it seems that IRB now only allows tab  
completion for the methods you get from entering “require  
‘irb/completion’”, and whatever is in the folder IRB is launched from.  
So if I launch from folder “foo” which contains folder “bar”, I can tab  
complete ‘bar/’ but won’t see anything in that folder.

I feel pretty confident that getting back to the old behavior is a  
simple matter of setting some option, but can’t for the life of me find  
it (I’ve been googling for some time now). Any help is much appreciated.

---

<div class="post-metadata">

**Author:** ![sclarke](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/b19c9b/32.png) [@sclarke](https://www.ruby-forum.com/u/sclarke)\
**Post date:** [September 24, 2009, 11:26pm UTC](https://www.ruby-forum.com/t/irb-tab-completion-fails-for-directories-in-ruby-0-9-1/176099/2 "2009-09-24T23:26:08Z")

</div>

On 2009-09-24, Stuart C. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> I recently upgraded from Ruby 0.8.6 to 0.9.1,

Might you mean _1_.8.6 and _1_.9.1?

If not, I might recommend that you try something a LITTLE more recent,  
because I’m pretty sure 0.9.1 was a while back.

(And I’m afraid I’m otherwise useless to you, as I didn’t even know irb  
had any kind of tab completion at all.)

-s

---

<div class="post-metadata">

**Author:** ![sclarke](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/b19c9b/32.png) [@sclarke](https://www.ruby-forum.com/u/sclarke)\
**Post date:** [September 24, 2009, 11:31pm UTC](https://www.ruby-forum.com/t/irb-tab-completion-fails-for-directories-in-ruby-0-9-1/176099/3 "2009-09-24T23:31:33Z")

</div>

Seebs wrote:

> On 2009-09-24, Stuart C. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:
> 
> > I recently upgraded from Ruby 0.8.6 to 0.9.1,
> 
> Might you mean _1_.8.6 and _1_.9.1?
> 
> If not, I might recommend that you try something a LITTLE more recent,  
> because I’m pretty sure 0.9.1 was a while back.
> 
> (And I’m afraid I’m otherwise useless to you, as I didn’t even know irb  
> had any kind of tab completion at all.)
> 
> -s

Yeah, I noticed that error slightly after posting, but couldn’t see a  
way to edit. That’s the problem with working with a bunch of different  
versions of several different packages, version numbers get all jumbled  
up.

---

<div class="post-metadata">

**Author:** ![sclarke](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/b19c9b/32.png) [@sclarke](https://www.ruby-forum.com/u/sclarke)\
**Post date:** [September 25, 2009, 5:50am UTC](https://www.ruby-forum.com/t/irb-tab-completion-fails-for-directories-in-ruby-0-9-1/176099/4 "2009-09-25T05:50:46Z")

</div>

> After trying to debug this problem it seems that IRB now only allows tab  
> completion for the methods you get from entering “require  
> ‘irb/completion’”, and whatever is in the folder IRB is launched from.  
> So if I launch from folder “foo” which contains folder “bar”, I can tab  
> complete ‘bar/’ but won’t see anything in that folder.

If you start irb without completion i.e. `irb -f`, irb should let  
readline  
default to file completion. You can also explicitly tell readline to  
do file  
completion but then you will lose irb’s method completion:

Readline.completion\_proc = Readline::FILENAME\_COMPLETION\_PROC

If you’re still having trouble with completing subdirectories, you may  
need to tweak  
some Readline settings:  
[http://ruby-doc.org/core-1.9/classes/Readline.html#M003133](http://ruby-doc.org/core-1.9/classes/Readline.html#M003133)

---

<div class="post-metadata">

**Author:** ![sclarke](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/b19c9b/32.png) [@sclarke](https://www.ruby-forum.com/u/sclarke)\
**Post date:** [September 25, 2009, 7:24pm UTC](https://www.ruby-forum.com/t/irb-tab-completion-fails-for-directories-in-ruby-0-9-1/176099/5 "2009-09-25T19:24:30Z")

</div>

cldwalker wrote:

> If you start irb without completion i.e. `irb -f`, irb should let  
> readline  
> default to file completion. You can also explicitly tell readline to  
> do file  
> completion but then you will lose irb’s method completion:
> 
> Readline.completion\_proc = Readline::FILENAME\_COMPLETION\_PROC
> 
> If you’re still having trouble with completing subdirectories, you may  
> need to tweak  
> some Readline settings:  
> [http://ruby-doc.org/core-1.9/classes/Readline.html#M003133](http://ruby-doc.org/core-1.9/classes/Readline.html#M003133)

I tried starting with -f, that didn’t work. I tried starting with  
–readline, that didn’t work. I tried both, I tried entering  
“Readline.completion\_proc = Readline::FILENAME\_COMPLETION\_PROC” after  
each of those things, and that didn’t work.

All of this (besides the launching commands) has been done in IRB  
itself. I tried setting the config file but can’t find the damn thing,  
and don’t think it should matter anyway (it seems like those are only  
settings you can set either within IRB or as you launch it).

As for tweaking Readline itself, how would I go about doing that? I’m  
not even sure where to begin with that.

Thanks for your help.
