diff --git a/README.org b/README.org index de04d44..a4d7eb6 100644 --- a/README.org +++ b/README.org @@ -143,6 +143,9 @@ C-c C-i Import the current buffer file like `from import *' in the C-c C-d py-vterm-interaction-send-cd-to-buffer-directory Send %cd function call to the Python REPL to change the current working directory of REPL to the buffer's directory. + +C-c C-a py-vterm-interaction-send-rerun-last + Send C-p to the repl to rerun the last line entered. #+end_example *** py-vterm-interaction-repl-mode diff --git a/py-vterm-interaction.el b/py-vterm-interaction.el index fe03506..2e16b79 100644 --- a/py-vterm-interaction.el +++ b/py-vterm-interaction.el @@ -644,6 +644,16 @@ python vterm buffer." (setq default-directory buffer-directory))) (message "The buffer is not associated with a directory."))) +(defun py-vterm-interaction-send-rerun-last () + "Rerun last repl command. + +(Send C-p )" + (interactive) + (py-vterm-interaction-clear-line) + (with-current-buffer (py-vterm-interaction-fellow-repl-buffer) + (vterm-send-key (kbd "C-p")) + (py-vterm-interaction-send-return-key))) + (defalias 'py-vterm-interaction-sync-wd #'py-vterm-interaction-send-cd-to-buffer-directory) (defun py-vterm-interaction-fellow-repl-prompt-status () @@ -664,7 +674,8 @@ python vterm buffer." (,(kbd "C-c C-i") . ,#'py-vterm-interaction-send-import-buffer-file) (,(kbd "C-c C-b") . ,#'py-vterm-interaction-send-buffer) (,(kbd "C-c C-r") . ,#'py-vterm-interaction-send-run-buffer-file) - (,(kbd "C-c C-d") . ,#'py-vterm-interaction-send-cd-to-buffer-directory))) + (,(kbd "C-c C-d") . ,#'py-vterm-interaction-send-cd-to-buffer-directory) + (,(kbd "C-c C-a") . ,#'py-vterm-interaction-send-rerun-last))) (provide 'py-vterm-interaction)