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

More than 1 year has passed since last update.


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配下に適当な名前をつけて保存。


Sign up for free and join this conversation.
Sign Up
If you already have a Qiita account log in.