vterm: allow moving the cursor backwards when exiting insert state

See #719
This commit is contained in:
Jakub Kadlcik 2023-04-18 18:09:37 +02:00
parent d9a70ef219
commit 7e34b53f0f
1 changed files with 7 additions and 1 deletions

View File

@ -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'.")