diff --git a/README.md b/README.md index bc32a916a..4cc56576a 100644 --- a/README.md +++ b/README.md @@ -309,6 +309,7 @@ neogit.setup { }, popup = { kind = "split", + show_title = false, }, stash = { kind = "tab", diff --git a/doc/neogit.txt b/doc/neogit.txt index 1c440182e..014e66c91 100644 --- a/doc/neogit.txt +++ b/doc/neogit.txt @@ -268,6 +268,7 @@ to Neovim users. }, popup = { kind = "split", + show_title = false, }, stash = { kind = "tab", diff --git a/lua/neogit/config.lua b/lua/neogit/config.lua index 8e10d582c..17dbbea85 100644 --- a/lua/neogit/config.lua +++ b/lua/neogit/config.lua @@ -107,6 +107,7 @@ end ---@class NeogitConfigPopup Popup window options ---@field kind WindowKind The type of window that should be opened +---@field show_title boolean Show a title for the popup ---@class NeogitConfigFloating ---@field relative? string @@ -535,6 +536,7 @@ function M.get_default_values() }, popup = { kind = "split", + show_title = false, }, stash = { kind = "tab", diff --git a/lua/neogit/lib/buffer.lua b/lua/neogit/lib/buffer.lua index 9e0d29564..486f0ae38 100644 --- a/lua/neogit/lib/buffer.lua +++ b/lua/neogit/lib/buffer.lua @@ -389,7 +389,7 @@ function Buffer:show() api.nvim_win_set_cursor(content_window, { 1, 0 }) win = content_window elseif self.kind == "popup" then - -- local title, _ = self.name:gsub("^Neogit", ""):gsub("Popup$", "") + local title, _ = self.name:gsub("^Neogit", ""):gsub("Popup$", "") local content_window = api.nvim_open_win(self.handle, true, { anchor = "SW", @@ -401,8 +401,8 @@ function Buffer:show() row = vim.o.lines - vim.o.cmdheight - (vim.o.laststatus > 0 and 1 or 0), style = "minimal", border = { "─", "─", "─", "", "", "", "", "" }, - -- title = (" %s Actions "):format(title), - -- title_pos = "center", + title = config.values.popup.show_title and (" %s Actions "):format(title) or nil, + title_pos = config.values.popup.show_title and "center" or nil, }) api.nvim_win_set_cursor(content_window, { 1, 0 }) diff --git a/tests/specs/neogit/config_spec.lua b/tests/specs/neogit/config_spec.lua index 69aee89ad..fdeea9beb 100644 --- a/tests/specs/neogit/config_spec.lua +++ b/tests/specs/neogit/config_spec.lua @@ -32,7 +32,7 @@ describe("Neogit config", function() end) it("should return invalid when disable_insert_on_commit isn't a boolean", function() - config.values.telescope_sorter = "not a boolean" + config.values.disable_insert_on_commit = "not a boolean" assert.True(vim.tbl_count(require("neogit.config").validate_config()) ~= 0) end) @@ -241,6 +241,11 @@ describe("Neogit config", function() assert.True(vim.tbl_count(require("neogit.config").validate_config()) ~= 0) end) + it("should return invalid when popup.show_title isn't a boolean", function() + config.values.popup.show_title = "not a boolean" + assert.True(vim.tbl_count(require("neogit.config").validate_config()) ~= 0) + end) + it("should return invalid when signs isn't a table", function() config.values.signs = "not a table" assert.True(vim.tbl_count(require("neogit.config").validate_config()) ~= 0)