diff --git a/README.md b/README.md index c6db30014..357561889 100644 --- a/README.md +++ b/README.md @@ -282,6 +282,7 @@ neogit.setup { recent = { folded = true, hidden = false, + always = false, }, rebase = { folded = true, diff --git a/doc/neogit.txt b/doc/neogit.txt index b8abcd514..d1fa5d1b2 100644 --- a/doc/neogit.txt +++ b/doc/neogit.txt @@ -310,6 +310,7 @@ to Neovim users. recent = { folded = true, hidden = false, + always = false, }, rebase = { folded = true, diff --git a/lua/neogit/buffers/status/ui.lua b/lua/neogit/buffers/status/ui.lua index 1efc135f6..962314642 100755 --- a/lua/neogit/buffers/status/ui.lua +++ b/lua/neogit/buffers/status/ui.lua @@ -517,6 +517,8 @@ function M.Status(state, config) local show_recent = #state.recent.items > 0 and not config.sections.recent.hidden + and (config.sections.recent.always or not show_upstream_unmerged) + return { List { @@ -668,7 +670,7 @@ function M.Status(state, config) folded = config.sections.unmerged_pushRemote.folded, name = "pushRemote_unmerged", }, - not show_upstream_unmerged and show_recent and Section { + show_recent and Section { title = SectionTitle { title = "Recent Commits", highlight = "NeogitRecentcommits" }, count = false, render = SectionItemCommit, diff --git a/lua/neogit/config.lua b/lua/neogit/config.lua index fd979e712..e90c33b1d 100644 --- a/lua/neogit/config.lua +++ b/lua/neogit/config.lua @@ -539,6 +539,7 @@ function M.get_default_values() recent = { folded = true, hidden = false, + always = false, }, rebase = { folded = true, diff --git a/tests/specs/neogit/config_spec.lua b/tests/specs/neogit/config_spec.lua index 0d169c33c..1032f10b2 100644 --- a/tests/specs/neogit/config_spec.lua +++ b/tests/specs/neogit/config_spec.lua @@ -404,6 +404,16 @@ describe("Neogit config", function() assert.True(vim.tbl_count(require("neogit.config").validate_config()) ~= 0) end) + it("should return invalid when sections.recent.hidden isn't a boolean", function() + config.values.sections.recent.hidden = "not a boolean" + assert.True(vim.tbl_count(require("neogit.config").validate_config()) ~= 0) + end) + + it("should return invalid when sections.recent.always isn't a boolean", function() + config.values.sections.recent.always = "not a boolean" + assert.False(vim.tbl_count(require("neogit.config").validate_config()) ~= 0) + end) + it("should return invalid when sections.recent.folded isn't a boolean", function() config.values.sections.recent.folded = "not a boolean" assert.True(vim.tbl_count(require("neogit.config").validate_config()) ~= 0)