mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-06-06 23:46:13 +02:00
Add JumpToBlock keybinding
This should allow users to decide their own keybinding for jumping between blocks/panels. E.g. A user could choose 5-9 instead of 1-5.
This commit is contained in:
parent
80a8e9b04d
commit
91e8765d9c
@ -101,6 +101,7 @@ keybinding:
|
|||||||
nextBlock: '<right>' # goto the next block / panel
|
nextBlock: '<right>' # goto the next block / panel
|
||||||
prevBlock-alt: 'h' # goto the previous block / panel
|
prevBlock-alt: 'h' # goto the previous block / panel
|
||||||
nextBlock-alt: 'l' # goto the next block / panel
|
nextBlock-alt: 'l' # goto the next block / panel
|
||||||
|
jumpToBlock: "1", "2", "3", "4", "5" # goto the Nth block / panel
|
||||||
nextMatch: 'n'
|
nextMatch: 'n'
|
||||||
prevMatch: 'N'
|
prevMatch: 'N'
|
||||||
optionMenu: 'x' # show help menu
|
optionMenu: 'x' # show help menu
|
||||||
|
@ -125,6 +125,7 @@ type KeybindingUniversalConfig struct {
|
|||||||
NextBlockAlt string `yaml:"nextBlock-alt"`
|
NextBlockAlt string `yaml:"nextBlock-alt"`
|
||||||
NextBlockAlt2 string `yaml:"nextBlock-alt2"`
|
NextBlockAlt2 string `yaml:"nextBlock-alt2"`
|
||||||
PrevBlockAlt2 string `yaml:"prevBlock-alt2"`
|
PrevBlockAlt2 string `yaml:"prevBlock-alt2"`
|
||||||
|
JumpToBlock [5]string `yaml:"JumpToBlock"`
|
||||||
NextMatch string `yaml:"nextMatch"`
|
NextMatch string `yaml:"nextMatch"`
|
||||||
PrevMatch string `yaml:"prevMatch"`
|
PrevMatch string `yaml:"prevMatch"`
|
||||||
StartSearch string `yaml:"startSearch"`
|
StartSearch string `yaml:"startSearch"`
|
||||||
@ -377,6 +378,7 @@ func GetDefaultConfig() *UserConfig {
|
|||||||
NextBlockAlt: "l",
|
NextBlockAlt: "l",
|
||||||
PrevBlockAlt2: "<backtab>",
|
PrevBlockAlt2: "<backtab>",
|
||||||
NextBlockAlt2: "<tab>",
|
NextBlockAlt2: "<tab>",
|
||||||
|
JumpToBlock: [5]string{"1", "2", "3", "4", "5"},
|
||||||
NextMatch: "n",
|
NextMatch: "n",
|
||||||
PrevMatch: "N",
|
PrevMatch: "N",
|
||||||
StartSearch: "/",
|
StartSearch: "/",
|
||||||
|
@ -1819,7 +1819,11 @@ func (gui *Gui) GetInitialKeybindings() []*Binding {
|
|||||||
|
|
||||||
// Appends keybindings to jump to a particular sideView using numbers
|
// Appends keybindings to jump to a particular sideView using numbers
|
||||||
for i, window := range []string{"status", "files", "branches", "commits", "stash"} {
|
for i, window := range []string{"status", "files", "branches", "commits", "stash"} {
|
||||||
bindings = append(bindings, &Binding{ViewName: "", Key: rune(i+1) + '0', Modifier: gocui.ModNone, Handler: gui.goToSideWindow(window)})
|
bindings = append(bindings, &Binding{
|
||||||
|
ViewName: "",
|
||||||
|
Key: gui.getKey(config.Universal.JumpToBlock[i]),
|
||||||
|
Modifier: gocui.ModNone,
|
||||||
|
Handler: gui.goToSideWindow(window)})
|
||||||
}
|
}
|
||||||
|
|
||||||
for viewName := range gui.State.Contexts.initialViewTabContextMap() {
|
for viewName := range gui.State.Contexts.initialViewTabContextMap() {
|
||||||
|
@ -322,7 +322,7 @@ func (gui *Gui) globalOptionsMap() map[string]string {
|
|||||||
gui.getKeyDisplay(keybindingConfig.Universal.Return): gui.Tr.LcCancel,
|
gui.getKeyDisplay(keybindingConfig.Universal.Return): gui.Tr.LcCancel,
|
||||||
gui.getKeyDisplay(keybindingConfig.Universal.Quit): gui.Tr.LcQuit,
|
gui.getKeyDisplay(keybindingConfig.Universal.Quit): gui.Tr.LcQuit,
|
||||||
gui.getKeyDisplay(keybindingConfig.Universal.OptionMenu): gui.Tr.LcMenu,
|
gui.getKeyDisplay(keybindingConfig.Universal.OptionMenu): gui.Tr.LcMenu,
|
||||||
"1-5": gui.Tr.LcJump,
|
fmt.Sprintf("%s-%s", gui.getKeyDisplay(keybindingConfig.Universal.JumpToBlock[0]), gui.getKeyDisplay(keybindingConfig.Universal.JumpToBlock[4])): gui.Tr.LcJump,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user