dan
dan

Reputation: 45652

ri output can't be piped into less

I'm running ri version 2.5.8 and ruby 1.9.2. If I try something like ri Enumerable | less, the paging is broken in less. I see output but I can't use CTRL-F or CTRL-B to page back and forward. If I try to, I just see the literal "^F" and "^B" characters output at the bottom of the screen. What's wrong?

Upvotes: 1

Views: 234

Answers (3)

Try PAGER=/usr/bin/less ri Enumerable - specifying pager in environment variables did the trick for me.

For a permanent solution do something like echo "export PAGER=/usr/bin/less" >> ~/.bash_profile && source ~/.bash_profile

Upvotes: 1

Francis Siefken
Francis Siefken

Reputation: 11

I can reproduce the problem on OSX 10.6 terminal and iTerm2 with ri version 2.5.8 and ruby 1.9.2. Did anyone find a fix? At the moment I can use the scrollbar of my graphical terminal client, but it gets tedious.

As a workaround I use the ORI gem, ri from within irb: https://github.com/dadooda/ori

Upvotes: 0

the Tin Man
the Tin Man

Reputation: 160601

Try ri -T String | less.

If you want that behavior always you could put alias ri='ri -T' in your ~/.bashrc or ~/.bash_profile or ~/.profile, which ever you use.

Upvotes: 1

Related Questions