send current line or region (#1)

* C-<return> to send region or current line
This commit is contained in:
Gaika 2020-10-04 01:51:50 -07:00 committed by GitHub
parent 44f3a43a83
commit 297840b23b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -152,6 +152,15 @@ already one with the process alive, just open it."
(julia-with-repl-vterm-send-return-key)))
(forward-line))
(defun julia-with-repl-vterm-send-region-or-current-line ()
(interactive)
(if (use-region-p)
(progn
(julia-with-repl-vterm-paste-string (buffer-substring-no-properties
(region-beginning) (region-end)))
(deactivate-mark))
(julia-with-repl-vterm-send-current-line)))
(defun julia-with-repl-vterm-send-buffer ()
(interactive)
(save-excursion
@ -163,7 +172,7 @@ already one with the process alive, just open it."
nil ""
`((,(kbd "C-c C-z") . julia-with-repl-vterm-switch-to-repl-buffer)
(,(kbd "C-c C-b") . julia-with-repl-vterm-send-buffer)
(,(kbd "C-<return>") . julia-with-repl-vterm-send-current-line)))
(,(kbd "C-<return>") . julia-with-repl-vterm-send-region-or-current-line)))
(add-hook 'julia-mode-hook (lambda () (julia-with-repl-vterm-mode 1)))