diff --git a/doc/neo-tree.txt b/doc/neo-tree.txt index e66325ce..2b77ed6f 100644 --- a/doc/neo-tree.txt +++ b/doc/neo-tree.txt @@ -1792,9 +1792,11 @@ Popups will be created with a |filetype| of `neo-tree-popup`. You can use this as the target for autocmds or to exclude them from being acted upon by other plugins. -They can also be configured by setting the `popup_border_style` in your config, -and the colors of that border are controlled by the `NeoTreeFloatBorder` -highlight group. If you you use the special `NC` option for +They can also be configured by setting the `popup_border_style` in your config. +To modify the title bar text that appears on a popup window, use +the `window.popup.title` config option to define a function mapping the window +state to a string. The colors of the popup border are controlled by the +`NeoTreeFloatBorder` highlight group.If you you use the special `NC` option for `popup_border_style`, the title bar of that popup uses the `NeoTreeTitleBar` highlight group. diff --git a/lua/neo-tree/defaults.lua b/lua/neo-tree/defaults.lua index cbd30c77..de86a203 100644 --- a/lua/neo-tree/defaults.lua +++ b/lua/neo-tree/defaults.lua @@ -356,6 +356,9 @@ local config = { width = "50%", }, position = "50%", -- 50% means center it + title = function (state) -- format the text that appears at the top of a popup window + return "Neo-tree " .. state.name:gsub("^%l", string.upper) + end, -- you can also specify border here, if you want a different setting from -- the global popup_border_style. }, diff --git a/lua/neo-tree/ui/renderer.lua b/lua/neo-tree/ui/renderer.lua index 095adaa1..24c500de 100644 --- a/lua/neo-tree/ui/renderer.lua +++ b/lua/neo-tree/ui/renderer.lua @@ -880,8 +880,14 @@ local function create_floating_window(state, win_options, bufname) local win state.force_float = nil -- First get the default options for floating windows. - local sourceTitle = state.name:gsub("^%l", string.upper) - win_options = popups.popup_options("Neo-tree " .. sourceTitle, 40, win_options) + local title = utils.resolve_config_option( + state, + "window.popup.title", + function (current_state) + return "Neo-tree " .. current_state.name:gsub("^%l", string.upper) + end + ) + win_options = popups.popup_options(title, 40, win_options) win_options.win_options = nil win_options.zindex = 40