Bash autocompletion in Emacs shell-mode

后端 未结 9 1471
有刺的猬
有刺的猬 2020-12-04 08:14

In the GNOME Terminal, Bash does smart auto-completion. For example

apt-get in

becomes

apt-get install
         


        
9条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-04 09:10

    In the emacs shell, it's actually emacs doing the auto-completion, not bash. If the shell and emacs are out of sync (e.g. by using pushd, popd or some bash user function that changes the shell's current directory), then auto-completion stops working.

    To fix this, just type 'dirs' into the shell and things get back in sync.

    I also have the following in my .emacs:

    (global-set-key "\M-\r" 'shell-resync-dirs)
    

    Then just hitting Esc-return resyncs the auto-completion.

提交回复
热议问题