Skip to content

Commit

Permalink
Add variable to simplify JumpToBlock keybinding
Browse files Browse the repository at this point in the history
This removes the magic '5' and instead uses the number of windows.
  • Loading branch information
samburville authored and jesseduffield committed Oct 22, 2021
1 parent f6e316d commit 5df0475
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions pkg/gui/keybindings.go
Original file line number Diff line number Diff line change
Expand Up @@ -1818,10 +1818,12 @@ func (gui *Gui) GetInitialKeybindings() []*Binding {
}

// Appends keybindings to jump to a particular sideView using numbers
if len(config.Universal.JumpToBlock) != 5 {
windows := []string{"status", "files", "branches", "commits", "stash"}

if len(config.Universal.JumpToBlock) != len(windows) {
log.Fatal("Jump to block keybindings cannot be set. Exactly 5 keybindings must be supplied.")
} else {
for i, window := range []string{"status", "files", "branches", "commits", "stash"} {
for i, window := range windows {
bindings = append(bindings, &Binding{
ViewName: "",
Key: gui.getKey(config.Universal.JumpToBlock[i]),
Expand Down

0 comments on commit 5df0475

Please sign in to comment.