You could use stopinsert.nvim Neovim plugin => https://github.com/csessh/stopinsert.nvim
More complete than using an autocommand: