1

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 ins

is enough instead of typing the whole:

package install

Is 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.

0

4 Answers 4

1

I believe fish shell would be in order here. To install:

  1. Download from here

  2. Then use this tutorial to assist you learning.

3
1

You need to install bash-completion. If already installed, you need to source it:

source /etc/bash_completion

You can add it in your .bashrc file. You can add custom completions in /etc/bash_completion.d/

1

bash does that by default if the bash-completion package is installed, just type e.g.

> apt i

press Tab ↹ and you'll get

> apt install

If there are multiple matches, pressing Tab ↹ another time will display a list of them., e.g.

> ap

Tab ↹

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
  • Thank you for you fast response, I am aware of this but am looking for auto completion without the need of pressing the tab key.
    – Eden K
    Sep 18, 2017 at 6:51
  • @EdenK You're welcome! Did I understand your question correctly, does this solve your problem? If not please edit your question and add details about what you want.
    – dessert
    Sep 18, 2017 at 6:52
  • I am looking for a solution in which I for instance can type "package ins" and hit enter rather than hitting the tab key. I know it only takes a second to hit the tab key but I am curious if such solution exists.
    – Eden K
    Sep 18, 2017 at 6:54
  • @EdenK Please edit your question and add this information there!
    – dessert
    Sep 18, 2017 at 6:56
  • @Edenk you could use fish shell Sep 18, 2017 at 7:06
1

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.

0

You must log in to answer this question.

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