InsertEnter
InsertEnter is an autocommand event in Vim and Neovim that fires when the editor enters insert mode. It runs after the mode change to insert mode has occurred, and it does not trigger when entering other modes. The event is commonly used to apply or adjust settings that should only be active while typing, or to trigger plugin behavior as soon as you start inserting text. It has a counterpart, InsertLeave, which fires when you leave insert mode, and there is also InsertCharPre, which runs just before a character is inserted in insert mode.
InsertEnter can be attached to with the :autocmd command, and its pattern can limit when it runs
autocmd InsertEnter * setlocal paste
autocmd InsertLeave * setlocal nopaste
Neovim users can also implement this in Lua, for example via the Neovim API:
vim.api.nvim_create_autocmd("InsertEnter", { pattern = "*", callback = function() vim.opt_local.paste = true end })
vim.api.nvim_create_autocmd("InsertLeave", { pattern = "*", callback = function() vim.opt_local.paste = false end })
InsertEnter is supported in Vim and Neovim as part of their autocommand and event systems. It is