{
  "inherits": null,
  "bindings": [
    {
      "comment": "M-x - execute extended command (command palette)",
      "key": "x",
      "modifiers": ["alt"],
      "action": "command_palette",
      "args": {},
      "when": "global"
    },
    {
      "key": "F10",
      "modifiers": [],
      "action": "menu_activate",
      "args": {},
      "when": "global"
    },
    {
      "comment": "Emacs movement - C-f/b/n/p",
      "key": "f",
      "modifiers": ["ctrl"],
      "action": "move_right",
      "args": {},
      "when": "normal"
    },
    {
      "key": "b",
      "modifiers": ["ctrl"],
      "action": "move_left",
      "args": {},
      "when": "normal"
    },
    {
      "key": "n",
      "modifiers": ["ctrl"],
      "action": "move_down",
      "args": {},
      "when": "normal"
    },
    {
      "key": "p",
      "modifiers": ["ctrl"],
      "action": "move_up",
      "args": {},
      "when": "normal"
    },
    {
      "key": "a",
      "modifiers": ["ctrl"],
      "action": "move_line_start",
      "args": {},
      "when": "normal"
    },
    {
      "key": "e",
      "modifiers": ["ctrl"],
      "action": "move_line_end",
      "args": {},
      "when": "normal"
    },
    {
      "comment": "Word movement - M-f/b and Ctrl+arrows",
      "key": "f",
      "modifiers": ["alt"],
      "action": "move_word_right",
      "args": {},
      "when": "normal"
    },
    {
      "key": "b",
      "modifiers": ["alt"],
      "action": "move_word_left",
      "args": {},
      "when": "normal"
    },
    {
      "key": "Left",
      "modifiers": ["ctrl"],
      "action": "move_word_left",
      "args": {},
      "when": "normal"
    },
    {
      "key": "Right",
      "modifiers": ["ctrl"],
      "action": "move_word_right",
      "args": {},
      "when": "normal"
    },
    {
      "comment": "Clipboard - C-w (kill), M-w (copy), C-y (yank)",
      "key": "w",
      "modifiers": ["ctrl"],
      "action": "cut",
      "args": {},
      "when": "normal"
    },
    {
      "key": "w",
      "modifiers": ["alt"],
      "action": "copy",
      "args": {},
      "when": "normal"
    },
    {
      "key": "y",
      "modifiers": ["ctrl"],
      "action": "paste",
      "args": {},
      "when": "normal"
    },
    {
      "comment": "C-g - keyboard quit",
      "key": "g",
      "modifiers": ["ctrl"],
      "action": "remove_secondary_cursors",
      "args": {},
      "when": "normal"
    },
    {
      "key": "g",
      "modifiers": ["ctrl"],
      "action": "prompt_cancel",
      "args": {},
      "when": "prompt"
    },
    {
      "key": "g",
      "modifiers": ["ctrl"],
      "action": "popup_cancel",
      "args": {},
      "when": "popup"
    },
    {
      "comment": "Transfer keyboard focus to the topmost popup (LSP popups appear unfocused so they don't swallow the next keystroke). Scoped to non-modal contexts so a user-overridden alt+t in normal/fileExplorer still wins at the same precedence level.",
      "key": "t",
      "modifiers": ["alt"],
      "action": "popup_focus",
      "args": {},
      "when": "normal"
    },
    {
      "key": "t",
      "modifiers": ["alt"],
      "action": "popup_focus",
      "args": {},
      "when": "fileExplorer"
    },
    {
      "key": "g",
      "modifiers": ["ctrl"],
      "action": "focus_editor",
      "args": {},
      "when": "file_explorer"
    },
    {
      "key": "g",
      "modifiers": ["ctrl"],
      "action": "menu_close",
      "args": {},
      "when": "menu"
    },
    {
      "comment": "C-x prefix commands (chords)",
      "keys": [
        {"key": "x", "modifiers": ["ctrl"]},
        {"key": "s", "modifiers": ["ctrl"]}
      ],
      "action": "save",
      "args": {},
      "when": "normal"
    },
    {
      "keys": [
        {"key": "x", "modifiers": ["ctrl"]},
        {"key": "f", "modifiers": ["ctrl"]}
      ],
      "action": "open",
      "args": {},
      "when": "normal"
    },
    {
      "keys": [
        {"key": "x", "modifiers": ["ctrl"]},
        {"key": "c", "modifiers": ["ctrl"]}
      ],
      "action": "quit",
      "args": {},
      "when": "normal"
    },
    {
      "comment": "C-x k - kill buffer (close)",
      "keys": [
        {"key": "x", "modifiers": ["ctrl"]},
        {"key": "k", "modifiers": []}
      ],
      "action": "close",
      "args": {},
      "when": "normal"
    },
    {
      "comment": "C-x o - other window (next split)",
      "keys": [
        {"key": "x", "modifiers": ["ctrl"]},
        {"key": "o", "modifiers": []}
      ],
      "action": "next_split",
      "args": {},
      "when": "normal"
    },
    {
      "comment": "C-x 0 - delete window (close split)",
      "keys": [
        {"key": "x", "modifiers": ["ctrl"]},
        {"key": "0", "modifiers": []}
      ],
      "action": "close_split",
      "args": {},
      "when": "normal"
    },
    {
      "comment": "C-x 2 - split below (horizontal)",
      "keys": [
        {"key": "x", "modifiers": ["ctrl"]},
        {"key": "2", "modifiers": []}
      ],
      "action": "split_horizontal",
      "args": {},
      "when": "normal"
    },
    {
      "comment": "C-x 3 - split right (vertical)",
      "keys": [
        {"key": "x", "modifiers": ["ctrl"]},
        {"key": "3", "modifiers": []}
      ],
      "action": "split_vertical",
      "args": {},
      "when": "normal"
    },
    {
      "comment": "M-g g - goto line",
      "keys": [
        {"key": "g", "modifiers": ["alt"]},
        {"key": "g", "modifiers": []}
      ],
      "action": "goto_line",
      "args": {},
      "when": "normal"
    },
    {
      "comment": "M-d - kill word forward",
      "key": "d",
      "modifiers": ["alt"],
      "action": "delete_word_forward",
      "args": {},
      "when": "normal"
    },
    {
      "comment": "M-Backspace - kill word backward",
      "key": "Backspace",
      "modifiers": ["alt"],
      "action": "delete_word_backward",
      "args": {},
      "when": "normal"
    },
    {
      "comment": "M-< - beginning of buffer",
      "key": ",",
      "modifiers": ["alt", "shift"],
      "action": "move_document_start",
      "args": {},
      "when": "normal"
    },
    {
      "comment": "M-> - end of buffer",
      "key": ".",
      "modifiers": ["alt", "shift"],
      "action": "move_document_end",
      "args": {},
      "when": "normal"
    },
    {
      "comment": "M-% - query replace",
      "key": "5",
      "modifiers": ["alt", "shift"],
      "action": "query_replace",
      "args": {},
      "when": "normal"
    },
    {
      "comment": "C-t - transpose chars",
      "key": "t",
      "modifiers": ["ctrl"],
      "action": "transpose_chars",
      "args": {},
      "when": "normal"
    },
    {
      "comment": "C-o - open line (insert newline, stay on line)",
      "key": "o",
      "modifiers": ["ctrl"],
      "action": "open_line",
      "args": {},
      "when": "normal"
    },
    {
      "comment": "C-l - recenter (scroll cursor to center)",
      "key": "l",
      "modifiers": ["ctrl"],
      "action": "recenter",
      "args": {},
      "when": "normal"
    },
    {
      "comment": "C-SPC - set mark (start selection)",
      "key": " ",
      "modifiers": ["ctrl"],
      "action": "set_mark",
      "args": {},
      "when": "normal"
    },
    {
      "comment": "Arrow keys still work",
      "key": "Left",
      "modifiers": [],
      "action": "move_left",
      "args": {},
      "when": "normal"
    },
    {
      "key": "Right",
      "modifiers": [],
      "action": "move_right",
      "args": {},
      "when": "normal"
    },
    {
      "key": "Up",
      "modifiers": [],
      "action": "move_up",
      "args": {},
      "when": "normal"
    },
    {
      "key": "Down",
      "modifiers": [],
      "action": "move_down",
      "args": {},
      "when": "normal"
    },
    {
      "comment": "Shift+arrows for selection",
      "key": "Left",
      "modifiers": ["shift"],
      "action": "select_left",
      "args": {},
      "when": "normal"
    },
    {
      "key": "Right",
      "modifiers": ["shift"],
      "action": "select_right",
      "args": {},
      "when": "normal"
    },
    {
      "key": "Up",
      "modifiers": ["shift"],
      "action": "select_up",
      "args": {},
      "when": "normal"
    },
    {
      "key": "Down",
      "modifiers": ["shift"],
      "action": "select_down",
      "args": {},
      "when": "normal"
    },
    {
      "comment": "Scrolling - Alt+arrows",
      "key": "Up",
      "modifiers": ["alt"],
      "action": "scroll_up",
      "args": {},
      "when": "normal"
    },
    {
      "key": "Down",
      "modifiers": ["alt"],
      "action": "scroll_down",
      "args": {},
      "when": "normal"
    },
    {
      "comment": "C-v/M-v - page down/up",
      "key": "v",
      "modifiers": ["ctrl"],
      "action": "move_page_down",
      "args": {},
      "when": "normal"
    },
    {
      "key": "v",
      "modifiers": ["alt"],
      "action": "move_page_up",
      "args": {},
      "when": "normal"
    },
    {
      "comment": "C-s - isearch forward",
      "key": "s",
      "modifiers": ["ctrl"],
      "action": "search",
      "args": {},
      "when": "normal"
    },
    {
      "comment": "C-d - delete char forward",
      "key": "d",
      "modifiers": ["ctrl"],
      "action": "delete_forward",
      "args": {},
      "when": "normal"
    },
    {
      "comment": "C-k - kill line",
      "key": "k",
      "modifiers": ["ctrl"],
      "action": "delete_line",
      "args": {},
      "when": "normal"
    },
    {
      "comment": "Basic editing",
      "key": "Backspace",
      "modifiers": [],
      "action": "delete_backward",
      "args": {},
      "when": "normal"
    },
    {
      "key": "Delete",
      "modifiers": [],
      "action": "delete_forward",
      "args": {},
      "when": "normal"
    },
    {
      "key": "Enter",
      "modifiers": [],
      "action": "insert_newline",
      "args": {},
      "when": "normal"
    },
    {
      "key": "Tab",
      "modifiers": [],
      "action": "insert_tab",
      "args": {},
      "when": "normal"
    },
    {
      "comment": "Home/End keys",
      "key": "Home",
      "modifiers": [],
      "action": "move_line_start",
      "args": {},
      "when": "normal"
    },
    {
      "key": "End",
      "modifiers": [],
      "action": "move_line_end",
      "args": {},
      "when": "normal"
    },
    {
      "key": "Home",
      "modifiers": ["ctrl"],
      "action": "move_document_start",
      "args": {},
      "when": "normal"
    },
    {
      "key": "End",
      "modifiers": ["ctrl"],
      "action": "move_document_end",
      "args": {},
      "when": "normal"
    },
    {
      "key": "PageUp",
      "modifiers": [],
      "action": "move_page_up",
      "args": {},
      "when": "normal"
    },
    {
      "key": "PageDown",
      "modifiers": [],
      "action": "move_page_down",
      "args": {},
      "when": "normal"
    },
    {
      "comment": "Undo - C-/ or C-_",
      "key": "/",
      "modifiers": ["ctrl"],
      "action": "undo",
      "args": {},
      "when": "normal"
    },
    {
      "comment": "Escape - cancel/quit",
      "key": "Escape",
      "modifiers": [],
      "action": "remove_secondary_cursors",
      "args": {},
      "when": "normal"
    },
    {
      "comment": "Prompt context bindings",
      "key": "Enter",
      "modifiers": [],
      "action": "prompt_confirm",
      "args": {},
      "when": "prompt"
    },
    {
      "key": "Escape",
      "modifiers": [],
      "action": "prompt_cancel",
      "args": {},
      "when": "prompt"
    },
    {
      "key": "Backspace",
      "modifiers": [],
      "action": "prompt_backspace",
      "args": {},
      "when": "prompt"
    },
    {
      "key": "Left",
      "modifiers": [],
      "action": "prompt_move_left",
      "args": {},
      "when": "prompt"
    },
    {
      "key": "Right",
      "modifiers": [],
      "action": "prompt_move_right",
      "args": {},
      "when": "prompt"
    },
    {
      "key": "Up",
      "modifiers": [],
      "action": "prompt_select_prev",
      "args": {},
      "when": "prompt"
    },
    {
      "key": "Down",
      "modifiers": [],
      "action": "prompt_select_next",
      "args": {},
      "when": "prompt"
    },
    {
      "key": "Home",
      "modifiers": [],
      "action": "prompt_move_start",
      "args": {},
      "when": "prompt"
    },
    {
      "key": "End",
      "modifiers": [],
      "action": "prompt_move_end",
      "args": {},
      "when": "prompt"
    },
    {
      "key": "Tab",
      "modifiers": [],
      "action": "prompt_accept_suggestion",
      "args": {},
      "when": "prompt"
    },
    {
      "key": "y",
      "modifiers": ["ctrl"],
      "action": "prompt_paste",
      "args": {},
      "when": "prompt"
    },
    {
      "key": "a",
      "modifiers": ["ctrl"],
      "action": "prompt_move_start",
      "args": {},
      "when": "prompt"
    },
    {
      "key": "e",
      "modifiers": ["ctrl"],
      "action": "prompt_move_end",
      "args": {},
      "when": "prompt"
    },
    {
      "comment": "Popup context bindings",
      "key": "Enter",
      "modifiers": [],
      "action": "popup_confirm",
      "args": {},
      "when": "popup"
    },
    {
      "key": "Escape",
      "modifiers": [],
      "action": "popup_cancel",
      "args": {},
      "when": "popup"
    },
    {
      "key": "Up",
      "modifiers": [],
      "action": "popup_select_prev",
      "args": {},
      "when": "popup"
    },
    {
      "key": "Down",
      "modifiers": [],
      "action": "popup_select_next",
      "args": {},
      "when": "popup"
    },
    {
      "key": "n",
      "modifiers": ["ctrl"],
      "action": "popup_select_next",
      "args": {},
      "when": "popup"
    },
    {
      "key": "p",
      "modifiers": ["ctrl"],
      "action": "popup_select_prev",
      "args": {},
      "when": "popup"
    },
    {
      "comment": "File explorer context",
      "key": "Escape",
      "modifiers": [],
      "action": "focus_editor",
      "args": {},
      "when": "file_explorer"
    },
    {
      "key": "Up",
      "modifiers": [],
      "action": "file_explorer_up",
      "args": {},
      "when": "file_explorer"
    },
    {
      "key": "Down",
      "modifiers": [],
      "action": "file_explorer_down",
      "args": {},
      "when": "file_explorer"
    },
    {
      "key": "Enter",
      "modifiers": [],
      "action": "file_explorer_open",
      "args": {},
      "when": "file_explorer"
    },
    {
      "key": "Right",
      "modifiers": [],
      "action": "file_explorer_expand",
      "args": {},
      "when": "file_explorer"
    },
    {
      "key": "Left",
      "modifiers": [],
      "action": "file_explorer_collapse",
      "args": {},
      "when": "file_explorer"
    },
    {
      "comment": "Menu context",
      "key": "Escape",
      "modifiers": [],
      "action": "menu_close",
      "args": {},
      "when": "menu"
    },
    {
      "key": "Enter",
      "modifiers": [],
      "action": "menu_execute",
      "args": {},
      "when": "menu"
    },
    {
      "key": "Up",
      "modifiers": [],
      "action": "menu_up",
      "args": {},
      "when": "menu"
    },
    {
      "key": "Down",
      "modifiers": [],
      "action": "menu_down",
      "args": {},
      "when": "menu"
    },
    {
      "key": "Left",
      "modifiers": [],
      "action": "menu_left",
      "args": {},
      "when": "menu"
    },
    {
      "key": "Right",
      "modifiers": [],
      "action": "menu_right",
      "args": {},
      "when": "menu"
    },
    {
      "comment": "Play last recorded macro (F4)",
      "key": "F4",
      "modifiers": [],
      "action": "play_last_macro",
      "args": {},
      "when": "normal"
    },
    {
      "comment": "Open the Remote Indicator menu (Local / SSH / Container actions)",
      "key": "F6",
      "modifiers": [],
      "action": "show_remote_indicator_menu",
      "args": {},
      "when": "global"
    },
    {
      "comment": "Composite buffer context - Close view (q)",
      "key": "q",
      "modifiers": [],
      "action": "close",
      "args": {},
      "when": "compositeBuffer"
    },
    {
      "comment": "Composite buffer context - Close view (Esc)",
      "key": "Escape",
      "modifiers": [],
      "action": "close",
      "args": {},
      "when": "compositeBuffer"
    },
    {
      "comment": "Composite buffer context - Next hunk (n)",
      "key": "n",
      "modifiers": [],
      "action": "composite_next_hunk",
      "args": {},
      "when": "compositeBuffer"
    },
    {
      "comment": "Composite buffer context - Previous hunk (p)",
      "key": "p",
      "modifiers": [],
      "action": "composite_prev_hunk",
      "args": {},
      "when": "compositeBuffer"
    },
    {
      "comment": "Composite buffer context - Next hunk (])",
      "key": "]",
      "modifiers": [],
      "action": "composite_next_hunk",
      "args": {},
      "when": "compositeBuffer"
    },
    {
      "comment": "Composite buffer context - Previous hunk ([)",
      "key": "[",
      "modifiers": [],
      "action": "composite_prev_hunk",
      "args": {},
      "when": "compositeBuffer"
    }
  ]
}
