Teach me please how to make Neovim execute a Lua function after exiting an insert mode.
Use an autocommand using the vim API:
vim.api.nvim_create_autocmd("InsertLeave", { callback = function() print("Exited insert mode!"); end });