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
|
||||||
|
@ -106,65 +106,66 @@ type KeybindingConfig struct {
|
|||||||
|
|
||||||
// damn looks like we have some inconsistencies here with -alt and -alt1
|
// damn looks like we have some inconsistencies here with -alt and -alt1
|
||||||
type KeybindingUniversalConfig struct {
|
type KeybindingUniversalConfig struct {
|
||||||
Quit string `yaml:"quit"`
|
Quit string `yaml:"quit"`
|
||||||
QuitAlt1 string `yaml:"quit-alt1"`
|
QuitAlt1 string `yaml:"quit-alt1"`
|
||||||
Return string `yaml:"return"`
|
Return string `yaml:"return"`
|
||||||
QuitWithoutChangingDirectory string `yaml:"quitWithoutChangingDirectory"`
|
QuitWithoutChangingDirectory string `yaml:"quitWithoutChangingDirectory"`
|
||||||
TogglePanel string `yaml:"togglePanel"`
|
TogglePanel string `yaml:"togglePanel"`
|
||||||
PrevItem string `yaml:"prevItem"`
|
PrevItem string `yaml:"prevItem"`
|
||||||
NextItem string `yaml:"nextItem"`
|
NextItem string `yaml:"nextItem"`
|
||||||
PrevItemAlt string `yaml:"prevItem-alt"`
|
PrevItemAlt string `yaml:"prevItem-alt"`
|
||||||
NextItemAlt string `yaml:"nextItem-alt"`
|
NextItemAlt string `yaml:"nextItem-alt"`
|
||||||
PrevPage string `yaml:"prevPage"`
|
PrevPage string `yaml:"prevPage"`
|
||||||
NextPage string `yaml:"nextPage"`
|
NextPage string `yaml:"nextPage"`
|
||||||
GotoTop string `yaml:"gotoTop"`
|
GotoTop string `yaml:"gotoTop"`
|
||||||
GotoBottom string `yaml:"gotoBottom"`
|
GotoBottom string `yaml:"gotoBottom"`
|
||||||
PrevBlock string `yaml:"prevBlock"`
|
PrevBlock string `yaml:"prevBlock"`
|
||||||
NextBlock string `yaml:"nextBlock"`
|
NextBlock string `yaml:"nextBlock"`
|
||||||
PrevBlockAlt string `yaml:"prevBlock-alt"`
|
PrevBlockAlt string `yaml:"prevBlock-alt"`
|
||||||
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"`
|
||||||
NextMatch string `yaml:"nextMatch"`
|
JumpToBlock [5]string `yaml:"JumpToBlock"`
|
||||||
PrevMatch string `yaml:"prevMatch"`
|
NextMatch string `yaml:"nextMatch"`
|
||||||
StartSearch string `yaml:"startSearch"`
|
PrevMatch string `yaml:"prevMatch"`
|
||||||
OptionMenu string `yaml:"optionMenu"`
|
StartSearch string `yaml:"startSearch"`
|
||||||
OptionMenuAlt1 string `yaml:"optionMenu-alt1"`
|
OptionMenu string `yaml:"optionMenu"`
|
||||||
Select string `yaml:"select"`
|
OptionMenuAlt1 string `yaml:"optionMenu-alt1"`
|
||||||
GoInto string `yaml:"goInto"`
|
Select string `yaml:"select"`
|
||||||
Confirm string `yaml:"confirm"`
|
GoInto string `yaml:"goInto"`
|
||||||
ConfirmAlt1 string `yaml:"confirm-alt1"`
|
Confirm string `yaml:"confirm"`
|
||||||
Remove string `yaml:"remove"`
|
ConfirmAlt1 string `yaml:"confirm-alt1"`
|
||||||
New string `yaml:"new"`
|
Remove string `yaml:"remove"`
|
||||||
Edit string `yaml:"edit"`
|
New string `yaml:"new"`
|
||||||
OpenFile string `yaml:"openFile"`
|
Edit string `yaml:"edit"`
|
||||||
ScrollUpMain string `yaml:"scrollUpMain"`
|
OpenFile string `yaml:"openFile"`
|
||||||
ScrollDownMain string `yaml:"scrollDownMain"`
|
ScrollUpMain string `yaml:"scrollUpMain"`
|
||||||
ScrollUpMainAlt1 string `yaml:"scrollUpMain-alt1"`
|
ScrollDownMain string `yaml:"scrollDownMain"`
|
||||||
ScrollDownMainAlt1 string `yaml:"scrollDownMain-alt1"`
|
ScrollUpMainAlt1 string `yaml:"scrollUpMain-alt1"`
|
||||||
ScrollUpMainAlt2 string `yaml:"scrollUpMain-alt2"`
|
ScrollDownMainAlt1 string `yaml:"scrollDownMain-alt1"`
|
||||||
ScrollDownMainAlt2 string `yaml:"scrollDownMain-alt2"`
|
ScrollUpMainAlt2 string `yaml:"scrollUpMain-alt2"`
|
||||||
ExecuteCustomCommand string `yaml:"executeCustomCommand"`
|
ScrollDownMainAlt2 string `yaml:"scrollDownMain-alt2"`
|
||||||
CreateRebaseOptionsMenu string `yaml:"createRebaseOptionsMenu"`
|
ExecuteCustomCommand string `yaml:"executeCustomCommand"`
|
||||||
PushFiles string `yaml:"pushFiles"`
|
CreateRebaseOptionsMenu string `yaml:"createRebaseOptionsMenu"`
|
||||||
PullFiles string `yaml:"pullFiles"`
|
PushFiles string `yaml:"pushFiles"`
|
||||||
Refresh string `yaml:"refresh"`
|
PullFiles string `yaml:"pullFiles"`
|
||||||
CreatePatchOptionsMenu string `yaml:"createPatchOptionsMenu"`
|
Refresh string `yaml:"refresh"`
|
||||||
NextTab string `yaml:"nextTab"`
|
CreatePatchOptionsMenu string `yaml:"createPatchOptionsMenu"`
|
||||||
PrevTab string `yaml:"prevTab"`
|
NextTab string `yaml:"nextTab"`
|
||||||
NextScreenMode string `yaml:"nextScreenMode"`
|
PrevTab string `yaml:"prevTab"`
|
||||||
PrevScreenMode string `yaml:"prevScreenMode"`
|
NextScreenMode string `yaml:"nextScreenMode"`
|
||||||
Undo string `yaml:"undo"`
|
PrevScreenMode string `yaml:"prevScreenMode"`
|
||||||
Redo string `yaml:"redo"`
|
Undo string `yaml:"undo"`
|
||||||
FilteringMenu string `yaml:"filteringMenu"`
|
Redo string `yaml:"redo"`
|
||||||
DiffingMenu string `yaml:"diffingMenu"`
|
FilteringMenu string `yaml:"filteringMenu"`
|
||||||
DiffingMenuAlt string `yaml:"diffingMenu-alt"`
|
DiffingMenu string `yaml:"diffingMenu"`
|
||||||
CopyToClipboard string `yaml:"copyToClipboard"`
|
DiffingMenuAlt string `yaml:"diffingMenu-alt"`
|
||||||
OpenRecentRepos string `yaml:"openRecentRepos"`
|
CopyToClipboard string `yaml:"copyToClipboard"`
|
||||||
SubmitEditorText string `yaml:"submitEditorText"`
|
OpenRecentRepos string `yaml:"openRecentRepos"`
|
||||||
AppendNewline string `yaml:"appendNewline"`
|
SubmitEditorText string `yaml:"submitEditorText"`
|
||||||
ExtrasMenu string `yaml:"extrasMenu"`
|
AppendNewline string `yaml:"appendNewline"`
|
||||||
ToggleWhitespaceInDiffView string `yaml:"toggleWhitespaceInDiffView"`
|
ExtrasMenu string `yaml:"extrasMenu"`
|
||||||
|
ToggleWhitespaceInDiffView string `yaml:"toggleWhitespaceInDiffView"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type KeybindingStatusConfig struct {
|
type KeybindingStatusConfig struct {
|
||||||
@ -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