How can I disable that "Display all possibilities" and --More-- stuff in bash?

9

2

In my shell, l + tab completes like:

wim@wim-zenbook:~$ l
Display all 135 possibilities? (y or n)

There's a prompt to answer y or n which is annoying, and it pages through with --More-- which is also annoying. How can we make it just show possibilities without the nags?

Using gnome-terminal on Ubuntu.

wim

Posted 2013-05-31T06:35:38.007

Reputation: 2 523

Answers

13

I read man pages of bash and was able to get the behaviour I wanted by adding the following lines in the file ~/.inputrc

set completion-query-items 0
set page-completions off

wim

Posted 2013-05-31T06:35:38.007

Reputation: 2 523

Regarding page-completions. From the manual "If set to On, readline uses an internal more-like pager to display a screenful of possible completions at a time." Arguably, a better option may be to turn this to On and prevent output scrolling off screen. – Tony Barganski – 2018-11-13T16:30:59.973

Looks much simpler than my answer ;) Apart from that I forget that part of your question with --more--... – mpy – 2013-05-31T07:02:14.083

3

I found that in bash's changelog:

If the rl_completion_query_items is set to a value < 0, readline never asks the user whether or not to view the possible completions.

To set this readline variable use

set completion-query-items [value]

This is an excerpt from man bash:

A variable may be set in the inputrc file (...)

completion-query-items (100) This determines when the user is queried about viewing the number of possible completions generated by the possible-completions command. It may be set to any integer value greater than or equal to zero. If the number of possible completions is greater than or equal to the value of this variable, the user is asked whether or not he wishes to view them; otherwise they are simply listed on the terminal.

As according to the doc you can't set this to a negative value, so I would suggest a very large number instead.

mpy

Posted 2013-05-31T06:35:38.007

Reputation: 20 866