Skip to content
This repository was archived by the owner on Dec 15, 2022. It is now read-only.
This repository was archived by the owner on Dec 15, 2022. It is now read-only.

Keyboard interactions for Git committing #174

@nathansobo

Description

@nathansobo

Before we staff ship, it should be possible to commit via this package without ever touching the mouse. Here's some initial thinking I did with @maxbrunsfeld on a comprehensive keybinding scheme.

  • Focusing and toggling the Git and GitHub panels. These bindings are based on a logical extension of the existing binding for toggling focus on the tree view. Since they're based on numbers, we could potentially extend this scheme even further to manage other panels:
    • Existing binding
      • ctrl-0 – focus/blur the tree view
    • Proposed new bindings:
      • ctrl-shift-0 – show/hide the tree view
      • ctrl-9 – focus/blur the Git panel
      • ctrl-shift-9 – show/hide the Git panel
      • ctrl-8 – focus/blur the GitHub panel ("8" for "Octocat")
      • ctrl-shift-8 – show/hide the GitHub panel
      • esc blurs the panel, returning focus to the active pane item
  • Moving focus between elements of the Git panel. When you focus the Git panel, either the unstaged/staged file list is focused or the commit message editor is focused.
    • "Sub-focus" is retained across panel focus/blur events, so you could blur the panel with the commit message editor focused, then still have the editor focused when you restore focus to the panel.
    • tab moves forward between merge conflicts, unstaged files, staged files and finally to the commit message editor. Once focus is in the editor, we do not change focus on tab but instead insert tabs / spaces into the editor. To return to the lists, use shift-tab.
    • shift-tab moves backward from the commit message editor to the staged files, unstaged files, and finally merge conflicts. To match behavior of tab going forward, we don't cycle around.
    • Intuitive arrow navigation
      • down on the last entry in the file list focuses the commit editor.
      • up at position (0, 0) of the editor moves to the last item of the file list.
  • Navigating unstaged/staged files
    • up and down navigate both unstaged and staged file lists as a single list.
    • left transfers focus from the panel to the currently selected diff
    • right transfers focus to the current diff back to the panel
    • enter toggles staging status on the selected file and selects the next item in the list.
  • Committing
    • cmd-enter (ctrl-enter on Win/Linux) anywhere in the git panel with a non-empty commit message creates a commit.
    • cmd-enter with an empty commit message focuses the commit editor.

/cc @atom/core

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions