mirror of
https://github.com/folke/lazy.nvim.git
synced 2025-04-18 20:36:45 +00:00
feat(ui): added support for setting a title of the lazy window. Fixes #814
This commit is contained in:
parent
97c2f8858c
commit
9dce0816f1
4 changed files with 15 additions and 3 deletions
|
@ -48,6 +48,8 @@ M.defaults = {
|
|||
wrap = true, -- wrap the lines in the ui
|
||||
-- The border to use for the UI window. Accepts same border values as |nvim_open_win()|.
|
||||
border = "none",
|
||||
title = nil, ---@type string only works when border is not "none"
|
||||
title_pos = "center", ---@type "center" | "left" | "right"
|
||||
icons = {
|
||||
cmd = " ",
|
||||
config = "",
|
||||
|
|
|
@ -9,6 +9,8 @@ local ViewConfig = require("lazy.view.config")
|
|||
---@field zindex? number
|
||||
---@field style? "" | "minimal"
|
||||
---@field border? "none" | "single" | "double" | "rounded" | "solid" | "shadow"
|
||||
---@field title? string
|
||||
---@field title_pos? "center" | "left" | "right"
|
||||
|
||||
---@class LazyFloat
|
||||
---@field buf number
|
||||
|
@ -50,6 +52,8 @@ function M:init(opts)
|
|||
border = self.opts.border,
|
||||
zindex = self.opts.zindex,
|
||||
noautocmd = true,
|
||||
title = self.opts.title,
|
||||
title_pos = self.opts.title and self.opts.title_pos or nil,
|
||||
}
|
||||
self:mount()
|
||||
self:on_key(ViewConfig.keys.close, self.close)
|
||||
|
|
|
@ -50,7 +50,10 @@ end
|
|||
function M.create()
|
||||
local self = setmetatable({}, { __index = setmetatable(M, { __index = Float }) })
|
||||
---@cast self LazyView
|
||||
Float.init(self)
|
||||
Float.init(self, {
|
||||
title = Config.options.ui.title,
|
||||
title_pos = Config.options.ui.title_pos,
|
||||
})
|
||||
|
||||
if Config.options.ui.wrap then
|
||||
vim.wo[self.win].wrap = true
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue