From ca4c6172240321a06498390d7d6fa790033f7fc1 Mon Sep 17 00:00:00 2001 From: Jakub Kadlcik Date: Wed, 27 Apr 2022 11:21:59 -0400 Subject: [PATCH] vterm: fix paste-before and add paste-after command The `vterm-yank` that is currently bound to `p` actually pastes before the cursor, so I am rebinding it to `P` and adding a function for pasting after the cursor. --- modes/vterm/evil-collection-vterm.el | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/modes/vterm/evil-collection-vterm.el b/modes/vterm/evil-collection-vterm.el index a2412ad..059ffc3 100644 --- a/modes/vterm/evil-collection-vterm.el +++ b/modes/vterm/evil-collection-vterm.el @@ -102,6 +102,13 @@ after the prompt." (vterm-goto-char (vterm--get-end-of-line)) (call-interactively #'evil-append)) +(declare-function vterm-yank "vterm") + +(defun evil-collection-vterm-paste-after (&optional arg) + (interactive "P") + (vterm-goto-char (+ 1 (point))) + (call-interactively #'vterm-yank arg)) + (evil-define-operator evil-collection-vterm-delete (beg end type register yank-handler) "Modification of evil-delete to work in vterm buffer. Delete text from BEG to END with TYPE. @@ -236,7 +243,8 @@ Save in REGISTER or in the kill-ring with YANK-HANDLER." (evil-collection-define-key 'normal 'vterm-mode-map "[[" 'vterm-previous-prompt "]]" 'vterm-next-prompt - "p" 'vterm-yank + "p" 'evil-collection-vterm-paste-after + "P" 'vterm-yank "a" 'evil-collection-vterm-append "A" 'evil-collection-vterm-append-line "d" 'evil-collection-vterm-delete