4
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

【2022年2月版】MacのVSCodeのエディタのVIMで、NORMALモードに戻る時に、IMEをOFFにしたい

Last updated at Posted at 2022-02-28

目的

MacのVSCodeのエディタのVIMで、NORMALモードに戻る時に、IMEをOFFにしたい。
ESCで戻る時も、ctrl + [ で戻る時もOFFにしたい。

環境

  • MacBook Pro(14インチ、2021)macOS Monterey 12.2.1
  • VSCode Version: 1.64.2 (Universal)

やること

  • im-selectをインストール
  • VSCodeの設定

やったこと

ime-selectをインストール

パーミッションは適切に設定してください。

% curl -Ls -o ~/Downloads/im-select https://github.com/daipeihust/im-select/raw/master/im-select-mac/out/apple/im-select
% sudo mv ~/Downloads/im-select /usr/local/bin/
% chmod 777 /usr/local/bin/im-select

im-selectの動作確認

# 日本語入力なし
% im-select 
com.google.inputmethod.Japanese.Roman
# 日本語入力に切り替えて
% im-select
com.apple.inputmethod.Kotoeri.RomajiTyping.Japanese

VSCodeのsetting.jsonを設定

以下の設定を追記

setting.json
+    "vim.autoSwitchInputMethod.defaultIM": "com.apple.keylayout.ABC",
+    "vim.autoSwitchInputMethod.obtainIMCmd": "/usr/bin/true",
+    "vim.autoSwitchInputMethod.switchIMCmd": "/usr/local/bin/im-select {im}",
+    "vim.autoSwitchInputMethod.enable": true

動作確認

setting.jsonが正しく記述できていれば、保存直後から ESC と ctrol - [ でNORMALモードに戻る時に日本語入力がオフになっています。

終わりに

先人の方達のおかげで、簡単でした。

参考にしたありがたいリソース

4
3
2

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
4
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?