branch: master
commit 7b91a3917da38fcc2e340e21505784254d16ba69
Author: Oleh Krehel <[email protected]>
Commit: Oleh Krehel <[email protected]>
ivy.el (ivy-kill-line): Add and bind to "C-k"
The only difference to `kill-line' is that it will kill the whole input
when at the end of the minibuffer. In that case, the regular `kill-line'
was extending into the second line of the minibuffer, which is
unacceptable.
---
ivy.el | 8 ++++++++
1 files changed, 8 insertions(+), 0 deletions(-)
diff --git a/ivy.el b/ivy.el
index 4facc63..377fed3 100644
--- a/ivy.el
+++ b/ivy.el
@@ -124,6 +124,7 @@ Only \"./\" and \"../\" apply here. They appear in reverse
order."
(define-key map (kbd "M-j") 'ivy-yank-word)
(define-key map (kbd "M-i") 'ivy-insert-current)
(define-key map (kbd "C-o") 'hydra-ivy/body)
+ (define-key map (kbd "C-k") 'ivy-kill-line)
map)
"Keymap used in the minibuffer.")
(autoload 'hydra-ivy/body "ivy-hydra" "" t)
@@ -589,6 +590,13 @@ On error (read-only), call `ivy-on-del-error-function'."
(unless (= (point) (line-end-position))
(kill-word arg)))
+(defun ivy-kill-line ()
+ "Forward to `kill-line'."
+ (interactive)
+ (if (eolp)
+ (kill-region (minibuffer-prompt-end) (point))
+ (kill-line)))
+
(defun ivy-backward-kill-word ()
"Forward to `backward-kill-word'."
(interactive)