Use ModeChanged events instead of InsertLeave emulation #4919 #4738
Some checks are pending
CI / build_image (push) Waiting to run
CI / test_ale (--linters-only) (push) Blocked by required conditions
CI / test_ale (--neovim-06-only) (push) Blocked by required conditions
CI / test_ale (--neovim-08-only) (push) Blocked by required conditions
CI / test_ale (--vim-80-only) (push) Blocked by required conditions
CI / test_ale (--vim-90-only) (push) Blocked by required conditions

`ModeChanged` looks like a more reliable way to detect an "exit insert mode" event and is a lot simpler (doesn't need a timer). Also, it can detect some other transitions like `\<C-o\>` in insert mode.
The `ModeChanged` event is available in:

* [Vim 8.2.3430](f1e8876fa2)
* [NeoVim 0.7.0](69bd1e4e36)

---------

Co-authored-by: Dmitry Zolotukhin <zlogic@gmail.com>
This commit is contained in:
w0rp
2025-03-10 21:28:20 +00:00
committed by GitHub
parent 3611c32d60
commit 0f71d4c494
3 changed files with 61 additions and 17 deletions

View File

@@ -158,9 +158,9 @@ Execute(The message at the cursor should be shown when linting ends):
AssertEqual 'semi: Missing semicolon.', g:last_message
Execute(The message at the cursor should be shown on InsertLeave):
Execute(The message at the cursor should be shown when leaving insert mode):
call cursor(2, 9)
doautocmd InsertLeave
call feedkeys("i\<Esc>", 'tnix')
AssertEqual 'space-infix-ops: Infix operators must be spaced.', g:last_message