From 0df5c4815d7be01ab52e9f957c56e6318c871217 Mon Sep 17 00:00:00 2001 From: Jakub Kadlcik Date: Tue, 18 Apr 2023 18:09:37 +0200 Subject: [PATCH] vterm: allow moving the cursor backwards when exiting insert state See #719 --- modes/vterm/evil-collection-vterm.el | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/modes/vterm/evil-collection-vterm.el b/modes/vterm/evil-collection-vterm.el index a77ee21..bafef53 100644 --- a/modes/vterm/evil-collection-vterm.el +++ b/modes/vterm/evil-collection-vterm.el @@ -40,11 +40,17 @@ (defvar vterm--process) +(defcustom evil-collection-vterm-move-cursor-back nil + "Whether the cursor is moved backwards when exiting insert state." + :type 'boolean + :group 'vterm) + (defun evil-collection-vterm-escape-stay () "Go back to normal state but don't move cursor backwards. Moving cursor backwards is the default vim behavior but it is not appropriate in some cases like terminals." - (setq-local evil-move-cursor-back nil)) + (setq-local evil-move-cursor-back + evil-collection-vterm-move-cursor-back)) (defvar-local evil-collection-vterm-send-escape-to-vterm-p nil "Track whether or not we send ESC to `vterm' or `emacs'.")