AgentSkillsCN

keyboard-shortcuts

参考键盘快捷键的实现方法、键位绑定的注册、与Vim及其他TUI工具的快捷键一致性,以及侧边栏插件中所有快捷键的完整分配表。适用于添加或修改键盘快捷键、检查快捷键分配、解决键冲突,或评估与Vim惯例的契合度的场景。

SKILL.md
--- frontmatter
name: keyboard-shortcuts
description: >
  Reference for keyboard shortcut implementation, keybinding registration,
  shortcut parity with vim and other TUI tools, and the complete shortcut
  assignment table across all sidecar plugins. Use when adding or modifying
  keyboard shortcuts, checking shortcut assignments, resolving key conflicts,
  or assessing alignment with vim conventions.

Keyboard Shortcuts

Complete shortcut listings and context reference for all sidecar plugins. For implementation patterns, see docs/guides/ui-feature-guide.md. For a detailed assessment of inconsistencies, vim alignment, mnemonic quality, and improvement proposals, see references/assessment.md in this skill directory.

Architecture

  • Centralized binding registry: internal/keymap/bindings.go is the single source of truth for key bindings.
  • Context-based dispatch: Each plugin defines contexts; bindings are scoped to contexts.
  • Command palette (?): Auto-discovers bindings for discoverability.
  • User overrides: Supported via ~/.config/sidecar/config.json.
  • Key sequences: Compound commands like g g are supported with 500ms timeout.

Adding a New Shortcut

  1. Add the binding in internal/keymap/bindings.go under the appropriate context.
  2. Add command handling in the plugin's Update() method (usually in a handlers.go file).
  3. Add the command to the plugin's Commands() method for footer hint and command palette.
  4. Keep command names short (1 word preferred) to prevent footer wrapping.

TD Monitor Shortcuts

TD shortcuts are dynamically exported from TD itself via ExportBindings() and ExportCommands() in pkg/monitor/keymap/. TD is the single source of truth. To add TD shortcuts:

  1. Add binding to TD's pkg/monitor/keymap/bindings.go
  2. Add command constant to TD's pkg/monitor/keymap/registry.go
  3. Add metadata to TD's pkg/monitor/keymap/export.go
  4. Handle in TD's pkg/monitor/model.go

Global Shortcuts

KeyCommandDescription
j / downcursor-downMove cursor down
k / upcursor-upMove cursor up
Gcursor-bottomJump to bottom
g gcursor-topJump to top
ctrl+dpage-downPage down
ctrl+upage-upPage up
enterselectSelect item
escbackGo back / close
`next-pluginNext plugin
~prev-pluginPrevious plugin
1-5focus-plugin-NFocus plugin by number
?toggle-paletteCommand palette
!toggle-diagnosticsDiagnostics overlay
@switch-projectProject switcher
rrefreshRefresh
qquitQuit (root contexts only)
ctrl+cquitForce quit

Sidebar Controls (All Two-Pane Plugins)

KeyAction
Tab / Shift+TabSwitch focus between panes
\Toggle sidebar visibility
h / leftFocus left pane
l / rightFocus right pane

Git Status Plugin

Contexts

ContextView
git-statusFile list (root)
git-status-commitsRecent commits sidebar (root)
git-status-diffInline diff pane (root)
git-commit-previewCommit detail in right pane
git-diffFull-screen diff
git-commitCommit editor
git-push-menuPush strategy selection
git-pull-menuPull strategy selection
git-pull-conflictConflict resolution
git-historyCommit history
git-commit-detailSingle commit view

File List Shortcuts

KeyCommandDescription
sstage-fileStage selected file
uunstage-fileUnstage selected file
Sstage-allStage all modified
Uunstage-allUnstage all
ccommitOpen commit editor
AamendAmend last commit
d / entershow-diffView file changes
Ddiscard-changesDiscard unstaged changes
hshow-historyOpen commit history
PpushOpen push menu
LpullOpen pull menu
ffetchFetch from remote
bbranchBranch operations
zstashStash changes
Zstash-popPop stash
ctrl+zstash-applyStash apply
oopen-in-githubOpen in GitHub
Oopen-in-file-browserOpen in file browser
yyank-fileCopy file info
Yyank-pathCopy file path

Commit List Shortcuts

KeyCommandDescription
enter / dview-commitOpen commit details
hshow-historyOpen history view
yyank-commitCopy commit as markdown
Yyank-idCopy commit hash
/search-historySearch commit messages
ffilter-authorFilter by author
pfilter-pathFilter by path
Fclear-filterClear filters
nnext-matchNext search match
Nprev-matchPrevious match
oopen-in-githubOpen commit in GitHub
vtoggle-graphToggle commit graph

Pull Menu

KeyCommand
ppull-merge
rpull-rebase
fpull-ff-only
apull-autostash

File Browser Plugin

Contexts

ContextView
file-browser-treeTree view (root)
file-browser-previewPreview pane
file-browser-searchFilename search
file-browser-content-searchContent search
file-browser-quick-openFuzzy file finder
file-browser-project-searchRipgrep search modal
file-browser-file-opFile operation input
file-browser-inline-editInline vim editor (all keys forwarded, global shortcuts bypassed)

Tree Shortcuts

KeyCommandDescription
/searchFilter files by name
ctrl+pquick-openFuzzy file finder
ctrl+sproject-searchProject-wide search
acreate-fileCreate new file
Acreate-dirCreate new directory
ddeleteDelete (with confirmation)
tnew-tabOpen in new tab
[prev-tabPrevious tab
]next-tabNext tab
xclose-tabClose active tab
yyankCopy to clipboard
ppastePaste from clipboard
ssortCycle sort mode
mmoveMove file/directory
RrenameRename
ctrl+rrevealReveal in file manager

Conversations Plugin

Contexts

ContextView
conversationsSession list single-pane (root)
conversations-sidebarSession list two-pane (root)
conversations-mainMessages pane
conversations-searchSearch mode
conversations-filterAdapter filter
conversation-detailTurn list
message-detailSingle turn content
analyticsUsage stats

Workspaces Plugin

Contexts

ContextView
workspace-listWorkspace list (root)
workspace-previewPreview pane
workspace-createCreate worktree input
workspace-task-linkTask selection modal
workspace-mergeMerge workflow modal
workspace-interactiveEmbedded terminal

List Shortcuts

KeyCommandDescription
nnew-workspaceCreate new workspace
vtoggle-viewToggle list/kanban
Ddelete-workspaceDelete workspace
ppushPush branch
mmerge-workflowStart merge workflow
Tlink-taskLink/unlink task
sstart-agentStart agent
enterinteractiveEnter interactive mode
tattachAttach to tmux
Sstop-agentStop agent
yapproveApprove agent prompt
NrejectReject agent prompt
[prev-tabPrevious preview tab
]next-tabNext preview tab

Interactive Mode

KeyCommand
ctrl+\exit
ctrl+]attach
alt+ccopy
alt+vpaste

TD Monitor Plugin

Contexts: td-monitor (root), td-modal, td-stats, td-search, td-confirm, td-epic-tasks, td-parent-epic, td-handoffs.

Shortcuts are defined in TD's pkg/monitor/keymap/ and auto-exported.

Project Switcher

KeyCommand
@toggle
down / ctrl+ncursor-down
up / ctrl+pcursor-up
Enterselect
Escclose

Command Palette

Press ? to open. Press tab to toggle between current-context and all-contexts view.

KeyAction
j / k / up / downNavigate
ctrl+d / ctrl+uPage down/up
enterExecute
escClose
tabToggle context filter

Known Conflicts and Design Decisions

Key conflicts exist across plugins (e.g., d = delete in file-browser, diff in git, delete-session in conversations). See references/assessment.md for the full inconsistency analysis, vim alignment audit, mnemonic analysis, and proposed improvement plan.

Shift Modifier Convention (Current)

  • s/S: stage / stage-all (git)
  • u/U: unstage / unstage-all (git)
  • d/D: diff / discard (git), delete/- (file-browser)
  • y/Y: yank item / yank path
  • n/N: next-match / prev-match (search contexts)