Qiita Teams that are logged in
You are not logged in to any team

Log in to Qiita Team
Community
OrganizationEventAdvent CalendarQiitadon (β)
Service
Qiita JobsQiita ZineQiita Blog
2
Help us understand the problem. What are the problem?

More than 5 years have passed since last update.

@takao-s

SublimeText 3 Key Bindings (Windows) Ver. 2015

いろいろ試行錯誤の結果個人的にはこれで落ち着いたような気がする。
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" : "[\"'\\}\\]\\)].*"}
        ]
    }
]
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
2
Help us understand the problem. What are the problem?