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
  • can you show us shopt -u and set -o ? – Valentin Bajrami Oct 1 '13 at 13:22
  • Seems Ok. I don't know what you did, but you might have set some path or something. Try hash -r -d and see if that helps. – Valentin Bajrami Oct 1 '13 at 13:47
  • Have you made any changes to /etc/bash_completion or the files in /etc/bash_completion.d/ or /usr/share/bash-completion/completions/? – terdon Oct 1 '13 at 14:02
  • Show the output of complete – daisy Oct 1 '13 at 14:34
  • hash -r -d didn't change anything. I don't think I have made any changes, but think this problem may have started after upgrading from Fedora 18 to 19 using fedup. – chris Oct 1 '13 at 15:37

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

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.