2017-06-08 11:47:56 +02:00
|
|
|
;;; tools/eshell/autoload/evil.el -*- lexical-binding: t; -*-
|
2017-11-04 22:11:55 +01:00
|
|
|
;;;###if (featurep! :feature evil)
|
2017-02-19 18:53:38 -05:00
|
|
|
|
2017-09-27 14:48:16 +02:00
|
|
|
;;;###autoload (autoload '+eshell:run "tools/eshell/autoload/evil" nil t)
|
|
|
|
(evil-define-command +eshell:run (command bang)
|
2017-06-08 11:47:56 +02:00
|
|
|
;; TODO Add COMMAND support
|
2017-02-19 18:53:38 -05:00
|
|
|
(interactive "<fsh><!>")
|
|
|
|
(if bang
|
2017-09-27 14:48:16 +02:00
|
|
|
(+eshell/open command)
|
|
|
|
(+eshell/open-popup command)))
|
2017-02-19 18:53:38 -05:00
|
|
|
|
2018-03-23 18:17:59 -04:00
|
|
|
;;;###autoload (autoload '+eshell/evil-change "tools/eshell/autoload/evil" nil t)
|
|
|
|
(evil-define-operator +eshell/evil-change (beg end type register yank-handler delete-func)
|
|
|
|
"Like `evil-change' but will not delete/copy the prompt."
|
|
|
|
(interactive "<R><x><y>")
|
|
|
|
(let ((delete-func (or delete-func #'evil-delete))
|
2018-04-02 06:17:49 -04:00
|
|
|
(nlines (1+ (evil-count-lines beg end))))
|
2018-03-23 18:17:59 -04:00
|
|
|
(unless (eq evil-want-fine-undo t)
|
|
|
|
(evil-start-undo-step))
|
|
|
|
(when (get-text-property beg 'read-only)
|
|
|
|
(save-excursion
|
|
|
|
(goto-char beg)
|
|
|
|
(evil-collection-eshell-next-prompt)
|
|
|
|
(setq beg (point))))
|
|
|
|
(funcall delete-func beg end type register yank-handler)
|
|
|
|
(cond
|
|
|
|
((eq type 'line)
|
|
|
|
(goto-char eshell-last-output-end)
|
|
|
|
(when (get-text-property (point) 'read-only)
|
|
|
|
(evil-collection-eshell-next-prompt))
|
|
|
|
(evil-append 1))
|
|
|
|
((eq type 'block) (evil-insert 1 nlines))
|
|
|
|
(t
|
|
|
|
(evil-insert 1)))))
|
|
|
|
|
|
|
|
;;;###autoload (autoload '+eshell/evil-change-line "tools/eshell/autoload/evil" nil t)
|
|
|
|
(evil-define-operator +eshell/evil-change-line (beg end type register yank-handler)
|
|
|
|
"Change to end of line."
|
|
|
|
:motion evil-end-of-line
|
|
|
|
(interactive "<R><x><y>")
|
|
|
|
(when (get-text-property beg 'read-only)
|
|
|
|
(save-excursion
|
|
|
|
(goto-char beg)
|
|
|
|
(evil-collection-eshell-next-prompt)
|
|
|
|
(setq beg (point))))
|
|
|
|
(evil-change beg end type register yank-handler #'evil-delete-line))
|