# GitComet Shortcuts

This file documents the keyboard shortcuts currently wired in the GPUI application.

Source of truth:
- `crates/gitcomet-ui-gpui/src/app.rs`
- `crates/gitcomet-ui-gpui/src/focused_diff.rs`
- `crates/gitcomet-ui-gpui/src/view/terminal_panel.rs`
- `crates/gitcomet-ui-gpui/src/view/panels/main/diff_view.rs`
- `crates/gitcomet-ui-gpui/src/view/conflict_resolver.rs`

Notes:
- `Cmd` and `Option` are the macOS names. `Ctrl` and `Alt` are the Windows/Linux equivalents.
- Some controls keep extra compatibility aliases in addition to the primary platform shortcut.
- Context menus also display per-entry shortcuts inline.

## App window shortcuts

These shortcuts apply in the normal GitComet window.

| Action | macOS | Windows / Linux | Notes |
| --- | --- | --- | --- |
| Open a new window | `Cmd-N`, `Cmd-Shift-N` | `Ctrl-N`, `Ctrl-Shift-N` | |
| Open Settings | `Cmd-,` | `Ctrl-,` | |
| Open a repository | `Cmd-O` | `Ctrl-O` | |
| Toggle open and recently closed repositories | `Ctrl-Shift-A`, `Cmd-Shift-O`, `Option-Cmd-O` | `Ctrl-Shift-A`, `Ctrl-Shift-O` | In an embedded terminal on Windows/Linux, `Ctrl-Shift-A` keeps its terminal “Select All” behavior. |
| Open active repository in external code editor | `Cmd-Shift-E` | `Ctrl-Shift-E` | Only active when an external code editor is configured. |
| Show the open file in the file explorer | `Cmd-Shift-L` | `Ctrl-Shift-L` | Switches the sidebar to Files, expands the folders leading to the file, and scrolls it into view. |
| Close the active repository tab, or close the window if no repo tab can close | `Cmd-W` | `Ctrl-W` | |
| Close the active window | `Cmd-Shift-W` | `Ctrl-Shift-W` | |
| Previous repository tab | `Cmd-PageUp`, `Cmd-{`, `Option-Cmd-Left` | `Ctrl-PageUp`, `Ctrl-Shift-Tab` | |
| Next repository tab | `Cmd-PageDown`, `Cmd-}`, `Option-Cmd-Right` | `Ctrl-PageDown`, `Ctrl-Tab` | |
| Toggle full screen | `Ctrl-Cmd-F` | `F11` | |
| Quit GitComet | `Cmd-Q` | `Ctrl-Q` | |

macOS-only window-management shortcuts:
- `Cmd-M`: Minimize the active window.
- `Cmd-H`: Hide GitComet.
- `Option-Cmd-H`: Hide other applications.

## Text input shortcuts

These shortcuts apply when a GitComet text input has focus.

### Editing

| Action | macOS | Windows / Linux | Notes |
| --- | --- | --- | --- |
| Select all | `Cmd-A` | `Ctrl-A` | `Ctrl-A` is also accepted on macOS. |
| Copy | `Cmd-C` | `Ctrl-C` | `Ctrl-C` is also accepted on macOS. |
| Paste | `Cmd-V` | `Ctrl-V` | `Ctrl-V` is also accepted on macOS. |
| Cut | `Cmd-X` | `Ctrl-X` | `Ctrl-X` is also accepted on macOS. |
| Undo | `Cmd-Z` | `Ctrl-Z` | |
| Redo | `Cmd-Shift-Z` | `Ctrl-Shift-Z` | |
| Show the character palette | `Ctrl-Cmd-Space` | None | macOS only. |

### Cursor movement and selection

| Action | macOS | Windows / Linux | Notes |
| --- | --- | --- | --- |
| Move by character or line | Arrow keys | Arrow keys | `Left`, `Right`, `Up`, `Down` |
| Select by character or line | `Shift` + arrow keys | `Shift` + arrow keys | |
| Move to line start / end | `Cmd-Left`, `Cmd-Right`, `Home`, `End` | `Home`, `End` | |
| Select to line start / end | `Cmd-Shift-Left`, `Cmd-Shift-Right`, `Shift-Home`, `Shift-End` | `Shift-Home`, `Shift-End` | |
| Move by page | `PageUp`, `PageDown` | `PageUp`, `PageDown` | |
| Select by page | `Shift-PageUp`, `Shift-PageDown` | `Shift-PageUp`, `Shift-PageDown` | |

### Word movement and word deletion

| Action | macOS | Windows / Linux | Notes |
| --- | --- | --- | --- |
| Move left / right by word | `Option-Left`, `Option-Right` | `Ctrl-Left`, `Ctrl-Right` | |
| Select left / right by word | `Option-Shift-Left`, `Option-Shift-Right` | `Ctrl-Shift-Left`, `Ctrl-Shift-Right` | |
| Delete word to the left / right | `Option-Backspace`, `Option-Delete` | `Ctrl-Backspace`, `Ctrl-Delete` | |

Compatibility note:
- GitComet also keeps the opposite modifier family wired in text inputs where practical, so `Alt`-based word movement and `Ctrl`-based editing aliases remain available as portability fallbacks.
- Diff-navigation fallbacks stay active from focused GitComet text inputs for `F1`, `F4`, `F2`, `F3`, `F7`, `Shift-F7`, `Alt-Up`, and `Alt-Down` when the input does not handle those keys itself.

### Commit composer

| Action | macOS | Windows / Linux | Notes |
| --- | --- | --- | --- |
| Commit staged changes | `Cmd-Enter` | `Ctrl-Enter` | Commit message input only, and only when the Commit action is enabled. |

## Embedded terminal shortcuts

These shortcuts apply when the embedded terminal has focus.

| Action | macOS | Windows / Linux | Notes |
| --- | --- | --- | --- |
| Copy terminal selection | `Cmd-C` | `Ctrl-Shift-C` | Disabled/no-op without a terminal selection. |
| Paste clipboard text | `Cmd-V` | `Ctrl-Shift-V` | Clipboard CRLF/CR line endings are normalized to LF. Bracketed paste is used when the shell enables it. |
| Select all terminal buffer | `Cmd-A` | `Ctrl-Shift-A` | Selects the scrollback buffer plus the visible terminal grid. |
| Scroll terminal history | `Shift-PageUp`, `Shift-PageDown`, `Shift-Home`, `Shift-End` | `Shift-PageUp`, `Shift-PageDown`, `Shift-Home`, `Shift-End` | Only in the normal screen buffer. |

Shell-input note:
- Plain `Ctrl-C`, `Ctrl-V`, and `Ctrl-A` keep going to the shell instead of GitComet clipboard handling.

Mouse and menu behavior:
- Left-drag selects visible terminal text.
- Right-click focuses the terminal and opens a menu without clearing the current selection.
- The terminal menu includes Copy, Paste, Select All, Clear, and Open in External Terminal.
- Clear sends `Ctrl-L` to the shell and is disabled when the embedded terminal is disconnected.

## Diff view shortcuts

These shortcuts apply in the main diff panel, including conflict resolution views where noted.

| Action | macOS | Windows / Linux | Scope / notes |
| --- | --- | --- | --- |
| Search the current diff | `Cmd-F` | `Ctrl-F` | If rendered markdown preview is open, GitComet switches back to source mode before opening search. |
| Insert a newline in diff search | `Shift-Enter` | `Shift-Enter` | Diff search only. The search box also has Match Case, Whole Word, and Regex toggles. |
| Previous search match | `F2` | `F2` | While diff search is open. |
| Next search match | `F3` | `F3` | While diff search is open. |
| Close search, clear selection, or close the current diff | `Escape` | `Escape` | Exact behavior depends on the current diff state. |
| Previous file in the status list | `F1` | `F1` | Working tree and conflict-oriented diff flows. |
| Next file in the status list | `F4` | `F4` | Working tree and conflict-oriented diff flows. |
| Previous change | `F2`, `Shift-F7`, `Option-Up` | `F2`, `Shift-F7`, `Alt-Up` | Raw diff and conflict diff views. |
| Next change | `F3`, `F7`, `Option-Down` | `F3`, `F7`, `Alt-Down` | Raw diff and conflict diff views. |
| Switch to inline diff | `Option-I` | `Alt-I` | Raw file diff only. Conflict resolver keeps split layout. |
| Enter or leave the file editor | `Option-E` | `Alt-E` | Not while a text field has focus. Escape also leaves the editor. |
| Save the edited file | `Cmd-S` | `Ctrl-S` | Only while the editor's buffer has focus; outside it the same chord stages the file. |
| Switch to split diff | `Option-S` | `Alt-S` | Raw file diff only. |
| Toggle whitespace characters | `Option-W` | `Alt-W` | Text diff / conflict diff only. |
| Stage or unstage the current working-tree file and advance to the adjacent file | `Space` | `Space` | Raw working-tree file diff only, and not while the diff search input has focus. |
| Select all diff text | `Cmd-A` | `Ctrl-A` | File preview and text-selection flows. |
| Copy selected diff text | `Cmd-C` | `Ctrl-C` | File preview and text-selection flows. |
| Pick conflict result `Base / Ours / Theirs / Both` | `A`, `B`, `C`, `D` | `A`, `B`, `C`, `D` | Conflict resolver only. |
| Previous unresolved conflict | `Shift-F2` | `Shift-F2` | Conflict resolver only. Skips conflicts you have already resolved; works while the resolved-output editor has focus. |
| Next unresolved conflict | `Shift-F3` | `Shift-F3` | Conflict resolver only. Skips conflicts you have already resolved; works while the resolved-output editor has focus. |
| First / last delta | `Cmd-Home` / `Cmd-End` | `Ctrl-Home` / `Ctrl-End` | Conflict resolver only. Not active while the resolved-output editor has focus, which keeps them for cursor movement. |
| Align selected lines manually | `Cmd-Y` | `Ctrl-Y` | Conflict resolver only (kdiff3 manual diff help). |
| Clear all manual alignments | `Cmd-Shift-Y` | `Ctrl-Shift-Y` | Conflict resolver only. |

Preview-mode note:
- Rendered markdown preview hides the raw diff navigation controls and ignores the raw-diff-only view toggles, whitespace toggle, and conflict navigation hotkeys until you return to source mode.
- The diff navigation keys above still work while a GitComet text input has focus, but search activation, `Escape`, view toggles, and staging `Space` remain tied to the active diff surface rather than text inputs.

## Context menu shortcuts

Context-menu keyboard behavior is the same on every platform:
- `Up` / `Down`: move the selection.
- `Enter`: activate the selected item, or the first enabled item if nothing is selected.
- `Escape`: close the menu.
- Single-letter shortcuts shown inline activate the matching entry.

Additional note:
- Some menus also show clipboard-style shortcuts such as `Ctrl+C`; those reflect the underlying view shortcut rather than the menu's generic single-letter dispatcher.

## Focused diff window

These shortcuts apply in the standalone focused diff window opened for difftool-style flows.

| Action | macOS | Windows / Linux | Notes |
| --- | --- | --- | --- |
| Close the window | `Cmd-W`, `Ctrl-W`, `Escape`, `Q` | `Ctrl-W`, `Escape`, `Q` | `Ctrl-W` remains accepted on macOS as an extra alias. |
