mirror of
https://github.com/doomemacs/doomemacs
synced 2025-08-21 13:53:38 -05:00
tools/eval: gr now sends to REPL if one is open #1941
And polish other evil repl commands + add docstrings.
This commit is contained in:
@@ -3,21 +3,24 @@
|
||||
|
||||
;;;###autoload (autoload '+eval:region "tools/eval/autoload/evil" nil t)
|
||||
(evil-define-operator +eval:region (beg end)
|
||||
"Send region to the currently open repl, if available."
|
||||
"Evaluate selection or sends it to the open REPL, if available."
|
||||
:move-point nil
|
||||
(interactive "<r>")
|
||||
(+eval/region beg end))
|
||||
(if (and (fboundp '+eval--ensure-in-repl-buffer)
|
||||
(+eval--ensure-in-repl-buffer))
|
||||
(+eval/send-region-to-repl (point-min) (point-max))
|
||||
(+eval/region beg end)))
|
||||
|
||||
;;;###autoload (autoload '+eval:replace-region "tools/eval/autoload/evil" nil t)
|
||||
(evil-define-operator +eval:replace-region (beg end)
|
||||
"Evaluate selection and replace it with its result."
|
||||
:move-point nil
|
||||
(interactive "<r>")
|
||||
(+eval/region-and-replace beg end))
|
||||
|
||||
;;;###autoload (autoload '+eval:repl "tools/eval/autoload/evil" nil t)
|
||||
(evil-define-operator +eval:repl (beg end &optional bang)
|
||||
"Open REPL and send the current selection to it."
|
||||
:move-point nil
|
||||
(interactive "<r><!>")
|
||||
(if (evil-normal-state-p)
|
||||
(+eval/open-repl-other-window bang)
|
||||
(+eval/send-region-to-repl beg end bang)))
|
||||
(+eval/open-repl-other-window))
|
||||
|
Reference in New Issue
Block a user