3
2

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 5 years have passed since last update.

SublimeText 3 Key Bindings (Windows) Ver. 2015

Posted at

いろいろ試行錯誤の結果個人的にはこれで落ち着いたような気がする。
sublime-text-multiple-commandsが入っていることが前提

[
    {
        "keys": ["j"],
        "command": "move",
        "args": {"by": "lines", "forward": true},
        "context": [
            {"key": "control", "operand": "sidebar_tree"}
        ]
    },
    {
        "keys": ["k"],
        "command": "move",
        "args": {"by": "lines", "forward": false},
        "context": [
            {"key": "control", "operand": "sidebar_tree"}
        ]
    },
    {
        "keys": ["l"],
        "command": "move",
        "args": {"by": "characters", "forward": true},
        "context": [
            {"key": "control", "operand": "sidebar_tree"}
        ]
    },
    {
        "keys": ["h"],
        "command": "move",
        "args": {"by": "characters", "forward": false},
        "context": [
            {"key": "control", "operand": "sidebar_tree"}
        ]
    },
    {// 数字がキャレット上に無い場合は全選択
        "keys": ["ctrl+a"],
        "command": "select_all",
        "context": [
            {"key": "vi_command_mode_aware"},
            {"key": "vi_use_ctrl_keys"},
            {"key": "following_text", "operator" : "not_regex_match", "operand" : "[0-9].*$"}
        ]
    },
    {// 数字がキャレット上にある場合はインクリメント
        "keys": ["ctrl+a"],
        "command": "press_key",
        "args": {"key": "<C-a>"},
        "context": [
            {"key": "vi_command_mode_aware"},
            {"key": "vi_use_ctrl_keys"},
            {"key": "following_text", "operator" : "regex_match", "operand" : "[0-9].*$"}
        ]
    },
    { "keys": ["ctrl+c"], "command": "copy" },
    { "keys": ["ctrl+r"], "command": "redo" },
    {
        "keys": ["ctrl+f"],
        "command": "show_panel",
        "args": {"panel": "find", "reverse": false}
    },
    {
        "keys": ["ctrl+h"],
        "command": "show_panel",
        "args": {"panel": "replace", "reverse": false}
    },
    {// ESCを代行
        "keys": ["ctrl+j"],
        "command": "press_key",
        "args": {"key": "<esc>"}
    },
    {// ノーマルモードに代わる時に、クォーテーションとか、ブラケットの終端の場合はキャレットを右に移動させる
        "keys": ["ctrl+j"],
        "command": "run_multiple_commands",
        "args": {
            "commands": [
                {"command": "press_key", "args": {"key" : "<right>"}, "context" : "window"},
                {"command": "press_key", "args": {"key" : "<esc>"}, "context" : "window"}
            ]
        },
        "context": [
            {"key": "vi_insert_mode_aware"},
            {"key": "vi_use_ctrl_keys"},
            {"key": "following_text", "operator" : "regex_match", "operand" : "[\"'\\}\\]\\)].*"}
        ]
    },
    {// ノーマルモードでも行末ペーストできるようにする
        "keys": ["ctrl+v"],
        "command": "run_multiple_commands",
        "args": {
            "commands": [
                {"command": "press_key", "args": {"key" : "a"}, "context" : "window"},
                {"command": "paste", "context" : "window"},
                {"command": "press_key", "args": {"key" : "<esc>"}, "context" : "window"}
            ]
        },
        "context": [
            {"key": "vi_command_mode_aware"},
            {"key": "vi_use_ctrl_keys"}
        ]
    },
    {// ノーマルモードのときにセーブできない・・・?
        "keys" : ["ctrl+s"],
        "command": "save",
        "context": [
            {"key": "vi_command_mode_aware"},
            {"key": "vi_use_ctrl_keys"}
        ]
    },
    {// ノーマルモードで文字選択時はカット(選択時限定にしないと、ラインカットになるので)
        "keys": ["ctrl+x"],
        "command": "cut",
        "context": [
            {"key": "vi_command_mode_aware"},
            {"key": "vi_use_ctrl_keys"},
            {"key": "selection_empty", "operator": "equal", "operand": false}
        ]
    },
    {// 数字がキャレット上にある場合はデクリメント
        "keys": ["ctrl+x"],
        "command": "press_key",
        "args": {"key": "<C-x>"},
        "context": [
            {"key": "vi_command_mode_aware"},
            {"key": "vi_use_ctrl_keys"},
            {"key": "text", "operator" : "regex_match", "operand" : "[0-9]"}
        ]
    },
    { "keys": ["ctrl+z"], "command": "undo" },
    {
        "keys": ["ctrl+k", "ctrl+v"],
        "command": "paste_from_history",
        "context": [
            {"key": "vi_insert_mode_aware"},
            {"key": "vi_use_ctrl_keys"}
        ]
    },
    {
        "keys": ["/"],
        "command": "show_panel",
        "args": {"panel": "find", "reverse": false},
        "context": [
            {"key": "vi_command_mode_aware"},
            {"key": "vi_use_ctrl_keys"}
        ]
    },
    {
        "keys" : ["["],
        "command" : "press_key",
        "args" : {
            "key" : "<home>"
        },
        "context" : [
            {"key": "vi_command_mode_aware"},
            {"key": "vi_use_ctrl_keys"}
        ]
    },
    { "keys": ["ctrl+["], "command": "unindent" },
    {
        "keys" : ["]"],
        "command" : "press_key",
        "args" : {
            "key" : "<end>"
        },
        "context" : [
            {"key": "vi_command_mode_aware"},
            {"key": "vi_use_ctrl_keys"}

        ]
    },
    {// オートコンプリートをタブで移動
        "keys": ["tab"],
        "command": "auto_complete",
        "context": [
            {"key": "vi_insert_mode_aware"},
            {"key": "vi_use_ctrl_keys"},
            {"key": "auto_complete_visible", "operator": "equal", "operand" : true}
        ]
    },
    {// オートコンプリートをタブで移動
        "keys": ["shift+tab"],
        "command": "auto_complete_prev",
        "context": [
            {"key": "vi_insert_mode_aware"},
            {"key": "vi_use_ctrl_keys"},
            {"key": "auto_complete_visible", "operand": "equal", "operand" : true}
        ]
    },
    {// ノーマルモードに代わる時に、クォーテーションとか、ブラケットの終端の場合はキャレットを右に移動させる
        "keys": ["escape"],
        "command": "run_multiple_commands",
        "args": {
            "commands": [
                {"command": "press_key", "args": {"key" : "<right>"}, "context" : "window"},
                {"command": "press_key", "args": {"key" : "<esc>"}, "context" : "window"}
            ]
        },
        "context": [
            {"key": "vi_insert_mode_aware"},
            {"key": "vi_use_ctrl_keys"},
            {"key": "following_text", "operator" : "regex_match", "operand" : "[\"'\\}\\]\\)].*"}
        ]
    }
]
3
2
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
3
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?