1

I've done something that has changed the way TAB auto-complete works, but only for the more command.

Every other command lists the possible completions, but more now lists ALL of the possibilities inside a pair of single quotes.

So in /etc, if I type

more pass<TAB>

The result is

$ more 'passwdqc.conf
passwd
passwd-' 

Typing

less pass<TAB>

Results in

$ less passwd
passwd         passwd-        passwdqc.conf  

How can I reset it so that more's autocompletion behaves more like less?

Edit:

$ shopt -u
autocd          off
cdable_vars     off
cdspell         off
checkhash       off
checkjobs       off
compat31        off
compat32        off
compat40        off
compat41        off
direxpand       off
dirspell        off
dotglob         off
execfail        off
extdebug        off
failglob        off
globstar        off
gnu_errfmt      off
histreedit      off
histverify      off
hostcomplete    off
huponexit       off
lastpipe        off
lithist         off
login_shell     off
mailwarn        off
no_empty_cmd_completion off
nocaseglob      off
nocasematch     off
nullglob        off
restricted_shell    off
shift_verbose   off
xpg_echo        off
$ set -o
allexport       off
braceexpand     on
emacs           on
errexit         off
errtrace        off
functrace       off
hashall         on
histexpand      on
history         on
ignoreeof       off
interactive-comments    on
keyword         off
monitor         on
noclobber       off
noexec          off
noglob          off
nolog           off
notify          off
nounset         off
onecmd          off
physical        off
pipefail        off
posix           off
privileged      off
verbose         off
vi              off
xtrace          off
terdon
  • 242,166
chris
  • 129

1 Answers1

1

I can reproduce:

_comp_foo() { compopt -o filenames -o nospace; COMPREPLY=("$(compgen -f -- "$2")"); }
complete -F _comp_foo foo
cd /etc

Type foo pass, Tab. You should see something like this:

foo 'passwd
passwd-'

:)

How can I reset it so that more's autocompletion behaves more like less?

You can reset a bash completion for NAME with complete -r NAME

help complete says:

-r - remove a completion specification for each NAME, or, if no NAMEs are supplied, all completion specifications

You can reuse an existing completion:

_completion_loader less 2>/dev/null # for bash-completion >= 1.9, bash >= 4.1
eval $(complete -p less | sed 's/ less$/ more/')

See also: how to re-use existing completion with recent bash-completion

Evgeny
  • 5,476