mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-08-06 22:33:07 +02:00
Show [0] keybinding in main view title (#4754)
- **PR Description** Show the `[0]` keybinding in the title of the main view, to make it more discoverable. Also, move it to the "global" section of the keybindings menu. And several minor fixes and cleanups, see individual commits for details. Fixes #4738.
This commit is contained in:
@ -340,6 +340,7 @@ _Legend: `<c-b>` means ctrl+b, `<a-b>` means alt+b, `B` means shift+b_
|
|||||||
| `` u `` | Check for update | |
|
| `` u `` | Check for update | |
|
||||||
| `` <enter> `` | Switch to a recent repo | |
|
| `` <enter> `` | Switch to a recent repo | |
|
||||||
| `` a `` | Show/cycle all branch logs | |
|
| `` a `` | Show/cycle all branch logs | |
|
||||||
|
| `` 0 `` | Focus main view | |
|
||||||
|
|
||||||
## Sub-commits
|
## Sub-commits
|
||||||
|
|
||||||
|
@ -175,6 +175,7 @@ _凡例:`<c-b>` はctrl+b、`<a-b>` はalt+b、`B` はshift+bを意味
|
|||||||
| `` u `` | 更新を確認 | |
|
| `` u `` | 更新を確認 | |
|
||||||
| `` <enter> `` | 最近のリポジトリをチェックアウト | |
|
| `` <enter> `` | 最近のリポジトリをチェックアウト | |
|
||||||
| `` a `` | ブランチログの表示モードを順に切り替え | |
|
| `` a `` | ブランチログの表示モードを順に切り替え | |
|
||||||
|
| `` 0 `` | Focus main view | |
|
||||||
|
|
||||||
## セカンダリ
|
## セカンダリ
|
||||||
|
|
||||||
|
@ -233,6 +233,7 @@ _Legend: `<c-b>` means ctrl+b, `<a-b>` means alt+b, `B` means shift+b_
|
|||||||
| `` u `` | 업데이트 확인 | |
|
| `` u `` | 업데이트 확인 | |
|
||||||
| `` <enter> `` | 최근에 사용한 저장소로 전환 | |
|
| `` <enter> `` | 최근에 사용한 저장소로 전환 | |
|
||||||
| `` a `` | Show/cycle all branch logs | |
|
| `` a `` | Show/cycle all branch logs | |
|
||||||
|
| `` 0 `` | Focus main view | |
|
||||||
|
|
||||||
## 서브모듈
|
## 서브모듈
|
||||||
|
|
||||||
|
@ -340,6 +340,7 @@ _Legend: `<c-b>` means ctrl+b, `<a-b>` means alt+b, `B` means shift+b_
|
|||||||
| `` u `` | Check voor updates | |
|
| `` u `` | Check voor updates | |
|
||||||
| `` <enter> `` | Wissel naar een recente repo | |
|
| `` <enter> `` | Wissel naar een recente repo | |
|
||||||
| `` a `` | Show/cycle all branch logs | |
|
| `` a `` | Show/cycle all branch logs | |
|
||||||
|
| `` 0 `` | Focus main view | |
|
||||||
|
|
||||||
## Sub-commits
|
## Sub-commits
|
||||||
|
|
||||||
|
@ -320,6 +320,7 @@ _Legenda: `<c-b>` oznacza ctrl+b, `<a-b>` oznacza alt+b, `B` oznacza shift+b_
|
|||||||
| `` u `` | Sprawdź aktualizacje | |
|
| `` u `` | Sprawdź aktualizacje | |
|
||||||
| `` <enter> `` | Przełącz na ostatnie repozytorium | |
|
| `` <enter> `` | Przełącz na ostatnie repozytorium | |
|
||||||
| `` a `` | Show/cycle all branch logs | |
|
| `` a `` | Show/cycle all branch logs | |
|
||||||
|
| `` 0 `` | Focus main view | |
|
||||||
|
|
||||||
## Sub-commity
|
## Sub-commity
|
||||||
|
|
||||||
|
@ -349,6 +349,7 @@ _Legend: `<c-b>` means ctrl+b, `<a-b>` means alt+b, `B` means shift+b_
|
|||||||
| `` u `` | Verificar atualização | |
|
| `` u `` | Verificar atualização | |
|
||||||
| `` <enter> `` | Mudar para um repositório recente | |
|
| `` <enter> `` | Mudar para um repositório recente | |
|
||||||
| `` a `` | Mostrar/ciclo todos os logs de filiais | |
|
| `` a `` | Mostrar/ciclo todos os logs de filiais | |
|
||||||
|
| `` 0 `` | Focus main view | |
|
||||||
|
|
||||||
## Sub-commits
|
## Sub-commits
|
||||||
|
|
||||||
|
@ -307,6 +307,7 @@ _Связки клавиш_
|
|||||||
| `` u `` | Проверить обновления | |
|
| `` u `` | Проверить обновления | |
|
||||||
| `` <enter> `` | Переключиться на последний репозиторий | |
|
| `` <enter> `` | Переключиться на последний репозиторий | |
|
||||||
| `` a `` | Show/cycle all branch logs | |
|
| `` a `` | Show/cycle all branch logs | |
|
||||||
|
| `` 0 `` | Focus main view | |
|
||||||
|
|
||||||
## Теги
|
## Теги
|
||||||
|
|
||||||
|
@ -341,6 +341,7 @@ _图例:`<c-b>` 意味着ctrl+b, `<a-b>意味着Alt+b, `B` 意味着shift+b_
|
|||||||
| `` u `` | 检查更新 | |
|
| `` u `` | 检查更新 | |
|
||||||
| `` <enter> `` | 切换到最近的仓库 | |
|
| `` <enter> `` | 切换到最近的仓库 | |
|
||||||
| `` a `` | 显示/循环所有分支日志 | |
|
| `` a `` | 显示/循环所有分支日志 | |
|
||||||
|
| `` 0 `` | Focus main view | |
|
||||||
|
|
||||||
## 确认面板
|
## 确认面板
|
||||||
|
|
||||||
|
@ -363,6 +363,7 @@ _說明:`<c-b>` 表示 Ctrl+B、`<a-b>` 表示 Alt+B,`B`表示 Shift+B
|
|||||||
| `` u `` | 檢查更新 | |
|
| `` u `` | 檢查更新 | |
|
||||||
| `` <enter> `` | 切換到最近使用的版本庫 | |
|
| `` <enter> `` | 切換到最近使用的版本庫 | |
|
||||||
| `` a `` | Show/cycle all branch logs | |
|
| `` a `` | Show/cycle all branch logs | |
|
||||||
|
| `` 0 `` | Focus main view | |
|
||||||
|
|
||||||
## 確認面板
|
## 確認面板
|
||||||
|
|
||||||
|
@ -260,6 +260,7 @@ func (gui *Gui) resetHelpersAndControllers() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for _, context := range []types.Context{
|
for _, context := range []types.Context{
|
||||||
|
gui.State.Contexts.Status,
|
||||||
gui.State.Contexts.Files,
|
gui.State.Contexts.Files,
|
||||||
gui.State.Contexts.Branches,
|
gui.State.Contexts.Branches,
|
||||||
gui.State.Contexts.RemoteBranches,
|
gui.State.Contexts.RemoteBranches,
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package controllers
|
package controllers
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/jesseduffield/lazygit/pkg/gui/keybindings"
|
|
||||||
"github.com/jesseduffield/lazygit/pkg/gui/types"
|
"github.com/jesseduffield/lazygit/pkg/gui/types"
|
||||||
"github.com/jesseduffield/lazygit/pkg/utils"
|
"github.com/jesseduffield/lazygit/pkg/utils"
|
||||||
"github.com/samber/lo"
|
"github.com/samber/lo"
|
||||||
@ -61,8 +60,8 @@ func (self *OptionsMenuAction) getBindings(context types.Context) ([]*types.Bind
|
|||||||
bindings, _ := self.c.GetInitialKeybindingsWithCustomCommands()
|
bindings, _ := self.c.GetInitialKeybindingsWithCustomCommands()
|
||||||
|
|
||||||
for _, binding := range bindings {
|
for _, binding := range bindings {
|
||||||
if keybindings.LabelFromKey(binding.Key) != "" && binding.Description != "" {
|
if binding.Description != "" {
|
||||||
if binding.ViewName == "" {
|
if binding.ViewName == "" || binding.Tag == "global" {
|
||||||
bindingsGlobal = append(bindingsGlobal, binding)
|
bindingsGlobal = append(bindingsGlobal, binding)
|
||||||
} else if binding.ViewName == context.GetViewName() {
|
} else if binding.ViewName == context.GetViewName() {
|
||||||
if binding.Tag == "navigation" {
|
if binding.Tag == "navigation" {
|
||||||
|
@ -32,6 +32,7 @@ func (self *SwitchToFocusedMainViewController) GetKeybindings(opts types.Keybind
|
|||||||
Key: opts.GetKey(opts.Config.Universal.FocusMainView),
|
Key: opts.GetKey(opts.Config.Universal.FocusMainView),
|
||||||
Handler: self.handleFocusMainView,
|
Handler: self.handleFocusMainView,
|
||||||
Description: self.c.Tr.FocusMainView,
|
Description: self.c.Tr.FocusMainView,
|
||||||
|
Tag: "global",
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,6 +17,10 @@ func Label(name string) string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func LabelFromKey(key types.Key) string {
|
func LabelFromKey(key types.Key) string {
|
||||||
|
if key == nil {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
keyInt := 0
|
keyInt := 0
|
||||||
|
|
||||||
switch key := key.(type) {
|
switch key := key.(type) {
|
||||||
|
@ -205,9 +205,15 @@ func (gui *Gui) configureViewProperties() {
|
|||||||
gui.Views.CommitDescription.TextArea.AutoWrapWidth = gui.c.UserConfig().Git.Commit.AutoWrapWidth
|
gui.Views.CommitDescription.TextArea.AutoWrapWidth = gui.c.UserConfig().Git.Commit.AutoWrapWidth
|
||||||
|
|
||||||
if gui.c.UserConfig().Gui.ShowPanelJumps {
|
if gui.c.UserConfig().Gui.ShowPanelJumps {
|
||||||
|
keyToTitlePrefix := func(key string) string {
|
||||||
|
if key == "<disabled>" {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
return fmt.Sprintf("[%s]", key)
|
||||||
|
}
|
||||||
jumpBindings := gui.c.UserConfig().Keybinding.Universal.JumpToBlock
|
jumpBindings := gui.c.UserConfig().Keybinding.Universal.JumpToBlock
|
||||||
jumpLabels := lo.Map(jumpBindings, func(binding string, _ int) string {
|
jumpLabels := lo.Map(jumpBindings, func(binding string, _ int) string {
|
||||||
return fmt.Sprintf("[%s]", binding)
|
return keyToTitlePrefix(binding)
|
||||||
})
|
})
|
||||||
|
|
||||||
gui.Views.Status.TitlePrefix = jumpLabels[0]
|
gui.Views.Status.TitlePrefix = jumpLabels[0]
|
||||||
@ -224,6 +230,8 @@ func (gui *Gui) configureViewProperties() {
|
|||||||
gui.Views.ReflogCommits.TitlePrefix = jumpLabels[3]
|
gui.Views.ReflogCommits.TitlePrefix = jumpLabels[3]
|
||||||
|
|
||||||
gui.Views.Stash.TitlePrefix = jumpLabels[4]
|
gui.Views.Stash.TitlePrefix = jumpLabels[4]
|
||||||
|
|
||||||
|
gui.Views.Main.TitlePrefix = keyToTitlePrefix(gui.c.UserConfig().Keybinding.Universal.FocusMainView)
|
||||||
} else {
|
} else {
|
||||||
gui.Views.Status.TitlePrefix = ""
|
gui.Views.Status.TitlePrefix = ""
|
||||||
|
|
||||||
@ -239,6 +247,8 @@ func (gui *Gui) configureViewProperties() {
|
|||||||
gui.Views.ReflogCommits.TitlePrefix = ""
|
gui.Views.ReflogCommits.TitlePrefix = ""
|
||||||
|
|
||||||
gui.Views.Stash.TitlePrefix = ""
|
gui.Views.Stash.TitlePrefix = ""
|
||||||
|
|
||||||
|
gui.Views.Main.TitlePrefix = ""
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, view := range gui.g.Views() {
|
for _, view := range gui.g.Views() {
|
||||||
|
Reference in New Issue
Block a user