branch: externals/ivy-hydra
commit b40af52729046cb28adbb7204c1dca0b223730af
Author: Oleh Krehel <[email protected]>
Commit: Oleh Krehel <[email protected]>
counsel.el (counsel-find-file-undo): Remap undo
Re #1424
---
counsel.el | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/counsel.el b/counsel.el
index f22976a..431ba23 100644
--- a/counsel.el
+++ b/counsel.el
@@ -1843,6 +1843,7 @@ currently checked out."
(define-key map (kbd "C-DEL") 'counsel-up-directory)
(define-key map (kbd "C-<backspace>") 'counsel-up-directory)
(define-key map (kbd "`") (ivy-make-magic-action 'counsel-find-file "b"))
+ (define-key map [remap undo] 'counsel-find-file-undo)
map))
(when (executable-find "git")
@@ -2194,6 +2195,15 @@ See variable `counsel-up-directory-level'."
(interactive)
(ivy--directory-enter))
+(defun counsel-find-file-undo ()
+ (interactive)
+ (if (string= ivy-text "")
+ (progn
+ (ivy-backward-delete-char)
+ (ivy--exhibit)
+ (ivy-insert-current))
+ (undo)))
+
(defun counsel-at-git-issue-p ()
"When point is at an issue in a Git-versioned file, return the issue string."
(and (looking-at "#[0-9]+")