1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-03-17 21:18:31 +02:00

Add variable to simplify JumpToBlock keybinding

This removes the magic '5' and instead uses the number of windows.
This commit is contained in:
Sam Burville 2021-10-18 10:06:03 +01:00 committed by Jesse Duffield
parent f6e316dfe5
commit 5df0475612

View File

@ -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]),