LoginSignup
9
9

More than 5 years have passed since last update.

Vimのノーマルモード中は自動的にIMEをOFFにする。(Windowsのみ)

Last updated at Posted at 2013-01-23

VimでIMEをオフにしようとするコマンドはset imdisableset iminsertなど
ありますが、結構使いどころが難しいです。
なので、rbtnn/winime.vimというVimプラグイン
を作りました。 これをインストールするとWindowsのIMEをVim scriptから制御できます。
で、これをインストールした後以下のコードをvimrcなどに記述すれば、
ノーマルモード中、誤って「半角/全角キー」を押したとしても自動的にIMEをOFFにしてくれます。

set updatetime=1000
function! s:winime_off()
  if exists("g:loaded_winime") && (has('win32') || has('win64'))
    if mode() !=# 'i'
      call winime#off()
      call feedkeys(mode() ==# 'i' ? "\<C-g>\<ESC>" : "g\<ESC>", 'n')
    endif
  endif
endfunction
augroup winime_off
  autocmd!
  autocmd CursorHold,CursorHoldI * call s:winime_off()
augroup END   
9
9
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
9
9