0

Often I will have multiple buffers open in Emacs, including a few eshells, and using the muscle-memory from bash, I will Command+K to try and clear the buffer in eshell. However, using this in eshell just screws up all of my buffers and I have to close everything and open everything again.

I would like to re-bind Command+K while in eshell to clear the e-shell buffer. If this is not possible, I would like to simply disable the effect of Command+K while in eshell, so that my muscle memory doesn't cause me to screw up my other buffers. Are either of these tasks possible?

Paradox
  • 1,935
  • 1
  • 18
  • 31

1 Answers1

0

You can bind key to local map in your case is "eshell-mode-map"

(define-key eshell-mode-map "\C-k" 'eshell/clear)
dunkaroo
  • 156
  • 7
  • My notes indicate that I had problems adding keys to `eshell` and had to do something extra like use the `eshell-mode-hook`: `(add-hook 'eshell-mode-hook (lambda () (define-key eshell-mode-map [return] 'eshell-send-input)))`. In addition, the call of the question is for the `super` modifier key rather than the `control` key. – lawlist Sep 06 '17 at 06:40
  • Hi, thanks for the reply, but I get the error "symbol's value as variable is void: eshell-mode-map". I tried adding what lawlist said, but I still get the same error. – Paradox Sep 08 '17 at 09:47