mirror of
https://github.com/jesseduffield/lazygit.git
synced 2026-09-10 07:36:27 -04:00
Add showFileChangeTabs gui option to enable/disable unstaged/staged tabs on [2] Files
This commit is contained in:
parent
c57461a1e6
commit
e7de017924
|
|
@ -246,6 +246,9 @@ gui:
|
|||
# If true, show jump-to-window keybindings in window titles.
|
||||
showPanelJumps: true
|
||||
|
||||
# If true, show separate Unstaged/Staged tabs in the Files window.
|
||||
showFileChangeTabs: false
|
||||
|
||||
# Nerd fonts version to use.
|
||||
# One of: '2' | '3' | empty string (default)
|
||||
# If empty, do not show icons.
|
||||
|
|
|
|||
|
|
@ -151,6 +151,8 @@ type GuiConfig struct {
|
|||
ShowBottomLine bool `yaml:"showBottomLine"`
|
||||
// If true, show jump-to-window keybindings in window titles.
|
||||
ShowPanelJumps bool `yaml:"showPanelJumps"`
|
||||
// If true, show separate Unstaged/Staged tabs in the Files window.
|
||||
ShowFileChangeTabs bool `yaml:"showFileChangeTabs"`
|
||||
// Deprecated: use nerdFontsVersion instead
|
||||
ShowIcons bool `yaml:"showIcons" jsonschema:"deprecated"`
|
||||
// Nerd fonts version to use.
|
||||
|
|
@ -817,6 +819,7 @@ func GetDefaultConfigForPlatform(platform string) *UserConfig {
|
|||
ShowCommandLog: true,
|
||||
ShowBottomLine: true,
|
||||
ShowPanelJumps: true,
|
||||
ShowFileChangeTabs: false,
|
||||
ShowFileTree: true,
|
||||
ShowRootItemInFileTree: true,
|
||||
FileTreeSortOrder: "mixed",
|
||||
|
|
|
|||
|
|
@ -832,6 +832,35 @@ func (gui *Gui) initGocui(headless bool, test integrationTypes.IntegrationTest)
|
|||
}
|
||||
|
||||
func (gui *Gui) viewTabMap() map[string][]context.TabView {
|
||||
filesTabs := []context.TabView{
|
||||
{
|
||||
Tab: gui.c.Tr.FilesTitle,
|
||||
ViewName: "files",
|
||||
},
|
||||
}
|
||||
if gui.c.UserConfig().Gui.ShowFileChangeTabs {
|
||||
filesTabs = append(filesTabs,
|
||||
context.TabView{
|
||||
Tab: gui.c.Tr.UnstagedChanges,
|
||||
ViewName: "files",
|
||||
},
|
||||
context.TabView{
|
||||
Tab: gui.c.Tr.StagedChanges,
|
||||
ViewName: "files",
|
||||
},
|
||||
)
|
||||
}
|
||||
filesTabs = append(filesTabs,
|
||||
context.TabView{
|
||||
Tab: gui.c.Tr.WorktreesTitle,
|
||||
ViewName: "worktrees",
|
||||
},
|
||||
context.TabView{
|
||||
Tab: gui.c.Tr.SubmodulesTitle,
|
||||
ViewName: "submodules",
|
||||
},
|
||||
)
|
||||
|
||||
result := map[string][]context.TabView{
|
||||
"branches": {
|
||||
{
|
||||
|
|
@ -857,28 +886,7 @@ func (gui *Gui) viewTabMap() map[string][]context.TabView {
|
|||
ViewName: "reflogCommits",
|
||||
},
|
||||
},
|
||||
"files": {
|
||||
{
|
||||
Tab: gui.c.Tr.FilesTitle,
|
||||
ViewName: "files",
|
||||
},
|
||||
{
|
||||
Tab: gui.c.Tr.UnstagedChanges,
|
||||
ViewName: "files",
|
||||
},
|
||||
{
|
||||
Tab: gui.c.Tr.StagedChanges,
|
||||
ViewName: "files",
|
||||
},
|
||||
context.TabView{
|
||||
Tab: gui.c.Tr.WorktreesTitle,
|
||||
ViewName: "worktrees",
|
||||
},
|
||||
{
|
||||
Tab: gui.c.Tr.SubmodulesTitle,
|
||||
ViewName: "submodules",
|
||||
},
|
||||
},
|
||||
"files": filesTabs,
|
||||
}
|
||||
|
||||
return result
|
||||
|
|
|
|||
|
|
@ -131,6 +131,9 @@ func (gui *Gui) filesTabIndex() int {
|
|||
if gui.State == nil || gui.State.Contexts == nil || gui.State.Contexts.Files == nil {
|
||||
return 0
|
||||
}
|
||||
if !gui.c.UserConfig().Gui.ShowFileChangeTabs {
|
||||
return 0
|
||||
}
|
||||
|
||||
filter := gui.State.Contexts.Files.GetStatusFilter()
|
||||
switch filter {
|
||||
|
|
@ -148,6 +151,10 @@ func (gui *Gui) applyFilesTab(tabName string) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
if !gui.c.UserConfig().Gui.ShowFileChangeTabs {
|
||||
return nil
|
||||
}
|
||||
|
||||
filesContext := gui.State.Contexts.Files
|
||||
desiredFilter := filetree.DisplayAll
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue