LoginSignup
0
0

More than 5 years have passed since last update.

WindowsのSublime Text 2 でVintageを使いやすくしたい

Posted at

INSERT MODEの時に日本語入力のままCOMMAND MODEになるのは非常に使いにくいのでプラグインを書いてみたよ。

Windows環境以外の方はググれば他の方が書いた物が見つかるはず。

exit_insert_mode_jp.py
import sublime, sublime_plugin
import ctypes
class ExitInsertModeJpCommand(sublime_plugin.TextCommand):
    def run(self, edit):
        try:
            hwnd = ctypes.windll.user32.GetActiveWindow()
            himc = ctypes.windll.imm32.ImmGetContext(hwnd)
            try:
                ctypes.windll.imm32.ImmSetOpenStatus(himc, 0)
            finally:
                ctypes.windll.imm32.ImmReleaseContext(hwnd, himc)
        finally:
            self.view.run_command("exit_insert_mode")
使い方

上のプラグインを%USERPROFILE%\AppData\Roaming\Sublime Text 2\Packages\Userあたりに突っ込んで

Preferences→Key Bindings - Userに以下のコードを追加

    { "keys": ["escape"], "command": "exit_insert_mode_jp",
        "context":
        [
            { "key": "setting.command_mode", "operand": false },
            { "key": "setting.is_widget", "operand": false }
        ]
    }
0
0
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
0
0