If the ESC key is not working in Vim's insert mode, you can try using the "Ctrl + [" key combination instead to exit insert mode. This is because the "Ctrl + [" key combination is the default mapping for the ESC key in Vim.
Exit insert mode if ESC not working Vim
To exit insert mode if the ESC key not working:
Press "control" and "[" keys together.
If you want to write and quit type :wq. Or simply quit using :q.
ctrl + [
If the above methods do not work, it may be an issue with your keyboard or Vim configuration. Try checking your keyboard settings or looking through your Vim configuration files for any conflicting keybindings.