I want completion like in emacs that if there is only a sole completion to the command you are typing, than you don't need to type it all.
For example:
package insis enough instead of typing the whole:
package installIs there a package or script that does that?
I am looking for a solution that doesn't require hitting the tab key but rather hitting the enter straight away and having a script do the auto completion before running the command.
04 Answers
I believe fish shell would be in order here. To install:
You need to install bash-completion.
If already installed, you need to source it:
source /etc/bash_completionYou can add it in your .bashrc file.
You can add custom completions in /etc/bash_completion.d/
bash does that by default if the bash-completion package is installed, just type e.g.
> apt ipress Tab ↹ and you'll get
> apt installIf there are multiple matches, pressing Tab ↹ another time will display a list of them., e.g.
> apTab ↹
nothing happens
Tab ↹
aplay apport-bug apt aptdcon aptitude-curses
aplaymidi apport-cli apt-add-repository apt-extracttemplates aptitude-run-state-bundle
apm_available apport-collect apt-cache apt-ftparchive apt-key
apparmor_parser apport-unpack apt-cdrom apt-get apt-mark
apparmor_status appres apt-config aptitude apt-sortpkgs
applygnupgdefaults apropos aptd aptitude-create-state-bundle 7 If your problem is you want Bash Completion, please refer to the post Terminal autocomplete doesn't work properly, else if you need Enter become as like Tab ↹ and also execute that command immediately, then you need to add the command below in your ~/.bashrc and then source ~/.bashrc it.
bind 'RET:"\C-i\C-j"'The RET is shortened for RETURN; You could use "\C-M" instead as well which is stands for Ctrl+M.