szermatt / emacs-bash-completion

Add programmable bash completion to Emacs shell-mode
GNU General Public License v2.0
279 stars 33 forks source link

Can we read .inputrc ? #31

Closed azzamsa closed 6 years ago

azzamsa commented 6 years ago

emacs-bash-completion works great for me.

But I miss my favorite readline functionality for long time. As asked here https://emacs.stackexchange.com/questions/41328/eshell-completion-cycle-through-the-possibilities

Can emacs-bash-completion support reading .inputrc ?

Thanks in advance. Thanks for this awesome package.

szermatt commented 6 years ago

Such a feature is available as part of comint mode, on which the shell mode is built. Try:

You can rebind it to whatever shortcut you want using the usual emacs keybinding configuration facilities.

abo-abo's swiper package also has some nice support also, try the command counsel-shell-history.

In general, the equivalent to .inputrc in emacs shell mode is emacs, for the keybindings, comint and shell-mode, for the commands. It's extremely powerful and configurable - but emacs-bash-completion has nothing to do with that.

azzamsa commented 6 years ago

Wow. Thank you.

comint was the key point. Since you mentioned it. I look that word through famous emacs config. Especially prelude. Then I find

;; shell history.
(define-key shell-mode-map (kbd "C-c C-l") 'helm-comint-input-ring)

which is really awesome. I tried M-r but it's only read current session history. So I figure out how to make presistent history. It all solved using helm-comint-input-ring. It reads my old history from other terminal app. Great :)


Sorry oot.

How to you make emacs shell always in sync with current dir. Most of the time cd <dir> doesn't work. I have to run M-x dirs manually.

How do you handle that ?

Thank you.

szermatt commented 6 years ago

I use dirtrack-mode. It requires you to include the current directory in the prompt, which I don't like, so I have PS1 start with "\w\r" and (setq dirtrack-list '("\\(.*\\)\r" 1)), so it's invisible.

See: https://www.gnu.org/software/emacs/manual/html_node/emacs/Directory-Tracking.html

And, in general, the shell mode documentation is well worth the read: https://www.gnu.org/software/emacs/manual/html_node/emacs/Shell.html#Shell

azzamsa commented 6 years ago

Great.

Thank you for your contribution to community.

Happy Hacking.