What Eshell's equivalent command for the shell command Ctrl-U?

523 views Asked by At

In Terminal, I can erase the entire input by Ctrl-U, without invoke it. Is there such a command in Eshell?

1

There are 1 answers

8
Chris On BEST ANSWER

You're looking for eshell-kill-input, which is bound to C-c C-u by default.

I don't think that eshell natively supports killing the entire input string (it only kills the text between point and the prompt), but some advice should take care of that:

;;; For Emacs 24.4 and later
(defun eshell-kill-input--go-to-eol ()
  "Go to end of line before killing input"
  (end-of-line))

(advice-add 'eshell-kill-input :before #'eshell-kill-input--go-to-eol)

;;; For Emacs versions before 24.4
(defadvice eshell-kill-input (before go-to-eol ())
  "Go to end of line before killing input"
  (end-of-line))