How can I configure MacVim, so that I can achieve this:

  1. When MacVim has focus and it's in normal mode, the Input Method should be US Layout.
  2. 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.

link|improve this question
feedback

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
or
required, but never shown

Browse other questions tagged or ask your own question.