@@ -33,6 +33,22 @@ type KeyMap struct {
3333 Stash key.Binding
3434 StashAll key.Binding
3535 Commit key.Binding
36+
37+ // Keybindings for BranchesPanel
38+ Checkout key.Binding
39+ NewBranch key.Binding
40+ DeleteBranch key.Binding
41+ RenameBranch key.Binding
42+
43+ // Keybindings for CommitsPanel
44+ AmendCommit key.Binding
45+ Revert key.Binding
46+ ResetToCommit key.Binding
47+
48+ // Keybindings for StashPanel
49+ StashApply key.Binding
50+ StashPop key.Binding
51+ StashDrop key.Binding
3652}
3753
3854// HelpSection is a struct to hold a title and keybindings for a help section.
@@ -60,6 +76,18 @@ func (k KeyMap) FullHelp() []HelpSection {
6076 k .StageAll , k .Discard , k .Reset ,
6177 },
6278 },
79+ {
80+ Title : "Branches" ,
81+ Bindings : []key.Binding {k .Checkout , k .NewBranch , k .DeleteBranch , k .RenameBranch },
82+ },
83+ {
84+ Title : "Commits" ,
85+ Bindings : []key.Binding {k .AmendCommit , k .Revert , k .ResetToCommit },
86+ },
87+ {
88+ Title : "Stash" ,
89+ Bindings : []key.Binding {k .StashApply , k .StashPop , k .StashDrop },
90+ },
6391 {
6492 Title : "Misc" ,
6593 Bindings : []key.Binding {k .SwitchTheme , k .ToggleHelp , k .Escape , k .Quit },
@@ -83,6 +111,24 @@ func (k KeyMap) FilesPanelHelp() []key.Binding {
83111 return append (help , k .ShortHelp ()... )
84112}
85113
114+ // BranchesPanelHelp returns a slice of key.Binding for the Branches Panel help bar.
115+ func (k KeyMap ) BranchesPanelHelp () []key.Binding {
116+ help := []key.Binding {k .Checkout , k .NewBranch , k .DeleteBranch }
117+ return append (help , k .ShortHelp ()... )
118+ }
119+
120+ // CommitsPanelHelp returns a slice of key.Binding for the Commits Panel help bar.
121+ func (k KeyMap ) CommitsPanelHelp () []key.Binding {
122+ help := []key.Binding {k .AmendCommit , k .Revert , k .ResetToCommit }
123+ return append (help , k .ShortHelp ()... )
124+ }
125+
126+ // StashPanelHelp returns a slice of key.Binding for the Stash Panel help bar.
127+ func (k KeyMap ) StashPanelHelp () []key.Binding {
128+ help := []key.Binding {k .StashApply , k .StashPop , k .StashDrop }
129+ return append (help , k .ShortHelp ()... )
130+ }
131+
86132// DefaultKeyMap returns a set of default keybindings.
87133func DefaultKeyMap () KeyMap {
88134 return KeyMap {
@@ -181,5 +227,48 @@ func DefaultKeyMap() KeyMap {
181227 key .WithKeys ("c" ),
182228 key .WithHelp ("c" , "Commit" ),
183229 ),
230+
231+ Checkout : key .NewBinding (
232+ key .WithKeys ("enter" ),
233+ key .WithHelp ("enter" , "Checkout" ),
234+ ),
235+ NewBranch : key .NewBinding (
236+ key .WithKeys ("n" ),
237+ key .WithHelp ("n" , "New Branch" ),
238+ ),
239+ DeleteBranch : key .NewBinding (
240+ key .WithKeys ("d" ),
241+ key .WithHelp ("d" , "Delete" ),
242+ ),
243+ RenameBranch : key .NewBinding (
244+ key .WithKeys ("r" ),
245+ key .WithHelp ("r" , "Rename" ),
246+ ),
247+
248+ AmendCommit : key .NewBinding (
249+ key .WithKeys ("A" ),
250+ key .WithHelp ("A" , "Amend" ),
251+ ),
252+ Revert : key .NewBinding (
253+ key .WithKeys ("v" ),
254+ key .WithHelp ("v" , "Revert" ),
255+ ),
256+ ResetToCommit : key .NewBinding (
257+ key .WithKeys ("R" ),
258+ key .WithHelp ("R" , "Reset to Commit" ),
259+ ),
260+
261+ StashApply : key .NewBinding (
262+ key .WithKeys ("a" ),
263+ key .WithHelp ("a" , "Apply" ),
264+ ),
265+ StashPop : key .NewBinding (
266+ key .WithKeys ("p" ),
267+ key .WithHelp ("p" , "Pop" ),
268+ ),
269+ StashDrop : key .NewBinding (
270+ key .WithKeys ("d" ),
271+ key .WithHelp ("d" , "Drop" ),
272+ ),
184273 }
185274}
0 commit comments