How can I configure MacVim, so that I can achieve this:
- When MacVim has focus and it's in normal mode, the Input Method should be US Layout.
- When MacVim is in insert mode or loses its focus or terminates, the Input Method should revert to the whatever it is before MacVim changes it to US Layout.
In my ~/.vimrc, I have this:
set noimd
if has("gui_running")
inoremap <ESC> <ESC>:set iminsert=2<CR>
endif
Now whenever it's in normal mode, the IM Layout is US, and the IM switch back to whatever it is when it enters insert mode. But, if MacVim loses focus or terminates when it's in normal mode, the system's IM still is US. How can I fix that? Many thanks.