4

For example, if I type in "apt-"and press tab,I can find "apt-get" below.But if I type in "get", "apt-get" cannot appear. How can I do to match not only from the beginning?

2 Answers 2

3

As far as I know, it is not possible to search sub strings of all possible commands at a time.

You do though have the option of searching for sub strings of previously typed commands by using Ctrl+R and then typing your sub string. You can press Ctrl+R again to cycle through the previously typed commands containing this sub string

1

zsh might be able to get you halfway there:

enter image description here enter image description here

For me, zsh seems to prefer prefix completions (file<tab> will get me file filefrag file-roller, -file<tab> will get me apt-file desktop-file-install ecryptfs-rewrite-file grub-file ...). I don't understand the completion system well enough to make zsh do substring matching even if prefix matching works. My completion options:

# The following lines were added by compinstall

zstyle ':completion:*' completer _expand _complete _ignored
zstyle ':completion:*' list-suffixes true
zstyle ':completion:*' matcher-list '' 'r:|[._-]=** r:|=**' 'l:|=* r:|=*' 'm:{[:lower:][:upper:]}={[:upper:][:lower:]}'
zstyle ':completion:*' squeeze-slashes true

autoload -Uz compinit
compinit
# End of lines added by compinstall
1
  • fish also seems to support this.
    – Léo Lam
    Jul 28, 2015 at 12:39

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .