// Zed keymap
//
// For information on binding keys, see the Zed
// documentation: https://zed.dev/docs/key-bindings
//
// To see the default key bindings run `zed: open default keymap`
// from the command palette.
[
    {
        "bindings": {
            "shift-tab": "menu::SelectPrev",
            "tab": "menu::SelectNext",
            "alt-c": "pane::CloseActiveItem",
            "ctrl-shift-w": null,
            "ctrl-q": null,
            "ctrl-h": ["workspace::ActivatePaneInDirection", "Left"],
            "ctrl-l": ["workspace::ActivatePaneInDirection", "Right"],
            "ctrl-k": ["workspace::ActivatePaneInDirection", "Up"],
            "ctrl-j": ["workspace::ActivatePaneInDirection", "Down"]
        }
    },
    {
        "context": "Workspace",
        "bindings": {
            "f5": "workspace::ToggleLeftDock",
            "alt-v": "terminal_panel::ToggleFocus"
        }
    },
    {
        "context": "menu",
        "bindings": {
            "shift-tab": "menu::SelectPrev",
            "tab": "menu::SelectNext",
            "f4": "menu::SelectPrev",
            "f6": "menu::SelectNext"
        }
    },
    {
        "context": "Terminal",
        "bindings": {
            "alt-v": "workspace::ToggleBottomDock",
            "ctrl-w": "terminal::ToggleViMode"
        }
    },
    {
        "context": "Editor",
        "bindings": {
            "alt-enter": "repl::Run"
        }
    },
    {
        "context": "VimControl && !menu",
        "bindings": {
            "; f s": "outline::Toggle",
            "; f w": "workspace::NewSearch",
            "; f t": "theme_selector::Toggle",
            "; f f": "file_finder::Toggle",
            "L": "vim::EndOfLine",
            "H": "vim::StartOfLine",
            "left": "editor::TabPrev",
            "right": "editor::Indent",
            "space v": "editor::ToggleComments",
            "alt-j": "vim::ScrollDown",
            "alt-k": "vim::ScrollUp",
            "up": "editor::MoveLineUp",
            "down": "editor::MoveLineDown",
            "space c a": "editor::ToggleCodeActions",
            "space y": "editor::Copy",
            "space p": "editor::Paste",
            "tab": "pane::ActivateNextItem",
            "shift-tab": "pane::ActivatePrevItem",
            "space \"": "pane::SplitRight",
            "space %": "pane::SplitHorizontal",
            "space c r": "editor::Rename",
            "space c t r": "diagnostics::Deploy",
            "#": [
                "vim::PushOperator",
                {
                    "Jump": {
                        "line": true
                    }
                }
            ]
        }
    },
    {
        "context": "vim_mode == normal",
        "bindings": {
            "space g g": [
                "task::Spawn",
                {
                    "task_name": "lazygit",
                    "reveal_target": "center"
                }
            ],
            "space f f": "editor::Format"
        }
    },
    {
        "context": "vim_mode == insert",
        "bindings": {
            "ctrl-l": "vim::Right",
            "ctrl-h": "vim::Left",
            "ctrl-j": "vim::Down",
            "ctrl-k": "vim::Up"
        }
    },
    {
        "context": "Editor && (showing_code_actions || showing_completions)",
        "bindings": {
            "shift-tab": "editor::ContextMenuPrev",
            "tab": "editor::ContextMenuNext"
        }
    },
    {
        "context": "ProjectPanel && not_editing",
        "bindings": {
            "n": "project_panel::NewFile",
            "N": "project_panel::NewDirectory",
            "r": "project_panel::Rename",
            "d": [
                "project_panel::Trash",
                {
                    "skip_prompt": false
                }
            ],
            "D": [
                "project_panel::Delete",
                {
                    "skip_prompt": false
                }
            ]
        }
    }
]
