LoginSignup
8

More than 5 years have passed since last update.

Windows版Sublime Text3のVintage Modeでnormal modeに戻ったらIMEを無効にする

Posted at

ソース

import sublime, sublime_plugin
import ctypes

class DisabledImeCommand(sublime_plugin.EventListener):
    def on_text_command(self, view, command_name, args):
        name = command_name.lower()
        # _enter_normal_modeはesc、exit_insert_modeはCtrl + [
        # Ctrl + [ も処理したいけど何だか挙動がおかしいのでやらない
        # if (name == '_enter_normal_mode' or name == 'exit_insert_mode'):
        if (name == '_enter_normal_mode'):
            # 29は無変換、IMEの設定にもとづき適宜置き換える
            ctypes.windll.user32.keybd_event(29, 0, 0, 0)

使い方

%USERPROFILE%\AppData\Roaming\Sublime Text 3\Packages\User配下に適当な名前をつけて保存。

参考

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
8