mirror of
https://github.com/akinsho/toggleterm.nvim
synced 2024-09-16 21:34:03 +02:00
feat: enable title for floating terminals (#534)
This commit is contained in:
parent
e3805fed94
commit
d3aa6e88c2
4 changed files with 12 additions and 1 deletions
|
@ -209,6 +209,7 @@ require("toggleterm").setup{
|
|||
height = <value>,
|
||||
winblend = 3,
|
||||
zindex = <value>,
|
||||
title_pos = 'left' | 'center' | 'right', position of the title of the floating window
|
||||
},
|
||||
winbar = {
|
||||
enabled = false,
|
||||
|
|
|
@ -195,6 +195,7 @@ what options are available. It is not written to be used as is.
|
|||
height = <value>,
|
||||
winblend = 3,
|
||||
zindex = <value>,
|
||||
title_pos = 'left' | 'center' | 'right', position of the title of the floating window
|
||||
},
|
||||
winbar = {
|
||||
enabled = false,
|
||||
|
|
|
@ -34,6 +34,7 @@ local function shade(color, factor) return colors.shade_color(color, factor) end
|
|||
--- @field highlights ToggleTermHighlights
|
||||
--- @field winbar WinbarOpts
|
||||
--- @field autochdir boolean
|
||||
--- @field title_pos '"left"' | '"center"' | '"right"'
|
||||
|
||||
---@type ToggleTermConfig
|
||||
local config = {
|
||||
|
@ -58,6 +59,7 @@ local config = {
|
|||
},
|
||||
float_opts = {
|
||||
winblend = 0,
|
||||
title_pos = 'left'
|
||||
},
|
||||
}
|
||||
|
||||
|
|
|
@ -285,7 +285,9 @@ function M._get_float_config(term, opening)
|
|||
row = vim.F.if_nil(M._resolve_size(opts.row, term), row)
|
||||
col = vim.F.if_nil(M._resolve_size(opts.col, term), col)
|
||||
|
||||
return {
|
||||
local version = vim.version()
|
||||
|
||||
local float_config = {
|
||||
row = row,
|
||||
col = col,
|
||||
relative = opts.relative or "editor",
|
||||
|
@ -295,6 +297,11 @@ function M._get_float_config(term, opening)
|
|||
border = opening and border or nil,
|
||||
zindex = opts.zindex or nil,
|
||||
}
|
||||
if version.major > 0 or version.minor >= 9 then
|
||||
float_config.title_pos = term.display_name and opts.title_pos or nil
|
||||
float_config.title = term.display_name
|
||||
end
|
||||
return float_config
|
||||
end
|
||||
|
||||
--- @param size number
|
||||
|
|
Loading…
Reference in a new issue