In the GNOME Terminal, Bash does smart auto-completion. For example
apt-get in<TAB>
becomes
apt-get install
In Emacs shell-mode, this auto-completion doesn't work, even after I explicitly source /etc/bash_completion
. The above example sticks as in
or auto-completes with a filename in the current directory rather than a valid apt-get
command option. Presumably, this is because Emacs is intercepting the Tab key-press. How do I enable smart auto-completion in shell-mode
?
You can execute an external shell command from within Emacs using ` M-! ' ( 'shell-command' ). The output from the shell command is displayed in the minibuffer or in a separate buffer, depending on the output size.
The programmable completion feature in Bash permits typing a partial command, then pressing the [Tab] key to auto-complete the command sequence. [1] If multiple completions are possible, then [Tab] lists them all. Let's see how it works. Tab completion also works for variables and path names.
I know this question is three years old, but it's something that I've also been interested in solving. A Web search directed me to a piece of elisp that makes Emacs use bash for completion in shell mode. It works for me, in any case.
Check it out at https://github.com/szermatt/emacs-bash-completion .
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With