Skip to content

Commit

Permalink
add tab keybindings
Browse files Browse the repository at this point in the history
  • Loading branch information
jesseduffield committed Mar 23, 2020
1 parent 3d3e0be commit 5d460e1
Show file tree
Hide file tree
Showing 5 changed files with 64 additions and 17 deletions.
10 changes: 10 additions & 0 deletions docs/keybindings/Keybindings_en.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,13 @@
<kbd>:</kbd>: execute custom command
</pre>

## Branches Panel

<pre>
<kbd>]</kbd>: next tab
<kbd>[</kbd>: previous tab
</pre>

## Branches Panel (Branches Tab)

<pre>
Expand Down Expand Up @@ -83,6 +90,8 @@
## Commits Panel

<pre>
<kbd>]</kbd>: next tab
<kbd>[</kbd>: previous tab
<kbd>/</kbd>: start search
</pre>

Expand Down Expand Up @@ -110,6 +119,7 @@
<kbd>space</kbd>: checkout commit
<kbd>i</kbd>: select commit to diff with another commit
<kbd>T</kbd>: tag commit
<kbd>ctrl+r</kbd>: reset cherry-picked (copied) commits selection
</pre>

## Commits Panel (Reflog Tab)
Expand Down
10 changes: 10 additions & 0 deletions docs/keybindings/Keybindings_nl.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,13 @@
<kbd>:</kbd>: voor aangepast commando uit
</pre>

## Branches Panel

<pre>
<kbd>]</kbd>: next tab
<kbd>[</kbd>: previous tab
</pre>

## Branches Panel (Branches Tab)

<pre>
Expand Down Expand Up @@ -83,6 +90,8 @@
## Commits Panel

<pre>
<kbd>]</kbd>: next tab
<kbd>[</kbd>: previous tab
<kbd>/</kbd>: start search
</pre>

Expand Down Expand Up @@ -110,6 +119,7 @@
<kbd>space</kbd>: checkout commit
<kbd>i</kbd>: select commit to diff with another commit
<kbd>T</kbd>: tag commit
<kbd>ctrl+r</kbd>: reset cherry-picked (copied) commits selection
</pre>

## Commits Panel (Reflog Tab)
Expand Down
10 changes: 10 additions & 0 deletions docs/keybindings/Keybindings_pl.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,13 @@
<kbd>:</kbd>: execute custom command
</pre>

## Gałęzie Panel

<pre>
<kbd>]</kbd>: next tab
<kbd>[</kbd>: previous tab
</pre>

## Gałęzie Panel (Branches Tab)

<pre>
Expand Down Expand Up @@ -83,6 +90,8 @@
## Commity Panel

<pre>
<kbd>]</kbd>: next tab
<kbd>[</kbd>: previous tab
<kbd>/</kbd>: start search
</pre>

Expand Down Expand Up @@ -110,6 +119,7 @@
<kbd>space</kbd>: checkout commit
<kbd>i</kbd>: select commit to diff with another commit
<kbd>T</kbd>: tag commit
<kbd>ctrl+r</kbd>: reset cherry-picked (copied) commits selection
</pre>

## Commity Panel (Reflog Tab)
Expand Down
45 changes: 28 additions & 17 deletions pkg/gui/keybindings.go
Original file line number Diff line number Diff line change
Expand Up @@ -618,16 +618,18 @@ func (gui *Gui) GetInitialKeybindings() []*Binding {
Description: gui.Tr.SLocalize("viewResetOptions"),
},
{
ViewName: "branches",
Key: gui.getKey("universal.nextTab"),
Modifier: gocui.ModNone,
Handler: gui.handleNextBranchesTab,
ViewName: "branches",
Key: gui.getKey("universal.nextTab"),
Modifier: gocui.ModNone,
Handler: gui.handleNextBranchesTab,
Description: gui.Tr.SLocalize("nextTab"),
},
{
ViewName: "branches",
Key: gui.getKey("universal.prevTab"),
Modifier: gocui.ModNone,
Handler: gui.handlePrevBranchesTab,
ViewName: "branches",
Key: gui.getKey("universal.prevTab"),
Modifier: gocui.ModNone,
Handler: gui.handlePrevBranchesTab,
Description: gui.Tr.SLocalize("prevTab"),
},
{
ViewName: "branches",
Expand All @@ -654,16 +656,18 @@ func (gui *Gui) GetInitialKeybindings() []*Binding {
Description: gui.Tr.SLocalize("fetchRemote"),
},
{
ViewName: "commits",
Key: gui.getKey("universal.nextTab"),
Modifier: gocui.ModNone,
Handler: gui.handleNextCommitsTab,
ViewName: "commits",
Key: gui.getKey("universal.nextTab"),
Modifier: gocui.ModNone,
Handler: gui.handleNextCommitsTab,
Description: gui.Tr.SLocalize("nextTab"),
},
{
ViewName: "commits",
Key: gui.getKey("universal.prevTab"),
Modifier: gocui.ModNone,
Handler: gui.handlePrevCommitsTab,
ViewName: "commits",
Key: gui.getKey("universal.prevTab"),
Modifier: gocui.ModNone,
Handler: gui.handlePrevCommitsTab,
Description: gui.Tr.SLocalize("prevTab"),
},
{
ViewName: "commits",
Expand Down Expand Up @@ -1474,7 +1478,14 @@ func (gui *Gui) GetInitialKeybindings() []*Binding {

// we need a specific keybinding for the commits panel beacuse it usually lazyloads commits
if listView.viewName != "commits" {
bindings = append(bindings, &Binding{ViewName: listView.viewName, Contexts: []string{listView.context}, Key: gui.getKey("universal.startSearch"), Modifier: gocui.ModNone, Handler: gui.handleOpenSearch, Description: gui.Tr.SLocalize("startSearch")})
bindings = append(bindings, &Binding{
ViewName: listView.viewName,
Contexts: []string{listView.context},
Key: gui.getKey("universal.startSearch"),
Modifier: gocui.ModNone,
Handler: gui.handleOpenSearch,
Description: gui.Tr.SLocalize("startSearch"),
})
}
}

Expand Down
6 changes: 6 additions & 0 deletions pkg/i18n/english.go
Original file line number Diff line number Diff line change
Expand Up @@ -1035,6 +1035,12 @@ func addEnglish(i18nObject *i18n.Bundle) error {
}, &i18n.Message{
ID: "resetCherryPick",
Other: "reset cherry-picked (copied) commits selection",
}, &i18n.Message{
ID: "nextTab",
Other: "next tab",
}, &i18n.Message{
ID: "prevTab",
Other: "previous tab",
},
)
}

0 comments on commit 5d460e1

Please sign in to comment.