I originally noticed this in MacVim, but turns out this happens in the terminal as well. If you have two tabs open and enter the Insert mode in one, then switch to the other tab (by clicking on it in GUI, for example), the Insert mode is still active. This wreaks havoc when I’m editing something and want to quickly switch to the other tab to search/look up/etc, because the Normal mode keystrokes get inserted into the buffer.
Any workarounds for this?
One way using autocommands:
Add this line to your
.vimrcfile and it should work as you wish.