[vim/vim] ESC not leaving insert mode after insert-mode + CTRL-o + operator mapping (Issue #18567)

5 views
Skip to first unread message

Pierre Ganty

unread,
12:36 PM (10 hours ago) 12:36 PM
to vim/vim, Subscribed
pierreganty created an issue (vim/vim#18567)

Steps to reproduce

:onoremap gb <cmd>normal! V<cr>
  1. Then typing cgb in Insert mode does require two <Esc> to exit into Normal mode.

Expected behaviour

Only one <Esc> to exit into Normal mode instead of two.

Version of Vim

9.1.754

Environment

macOS 15.7
ghostty 1.2.2
$TERM is xterm-ghostty

Logs and stack traces

See also for mor details / how we got there: https://github.com/neovim/neovim/issues/36119


Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/18567@github.com>

Christian Brabandt

unread,
4:49 PM (6 hours ago) 4:49 PM
to vim/vim, Subscribed
chrisbra left a comment (vim/vim#18567)

I think this fixes it, but not sure what this breaks:

diff --git a/src/ops.c b/src/ops.c
index 1544f34d4..9f094d625 100644
--- a/src/ops.c
+++ b/src/ops.c
@@ -4377,7 +4377,7 @@ do_pending_operator(cmdarg_T *cap, int old_col, int gui_yank)
                // remember it to make 'insertmode' work with mappings for
                // Visual mode.  But do this only once and not when typed and
                // 'insertmode' isn't set.
-               if (p_im || !KeyTyped)
+               if (p_im)
                    restart_edit_save = restart_edit;
                else
                    restart_edit_save = 0;


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/18567/3399032499@github.com>

Reply all
Reply to author
Forward
0 new messages