Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,8 @@ require("bento").setup({
| `offset_y` | number | `0` | Vertical offset from position |
| `dash_char` | string | `"─"` | Character for collapsed state lines |
| `border` | string | `"none"` | Border style for the floating window: `"rounded"`, `"single"`, `"double"`, etc. (see :h winborder) |
| `title` | string/nil | `nil` | Optional border title (floating UI only) |
| `title_pos` | string | `"center"` | Title alignment: `"left"`, `"center"`, `"right"` (only applied when `title` is set) |
| `label_padding` | number | `1` | Padding on left/right of labels |
| `minimal_menu` | string/nil | `nil` | Collapsed menu style: `nil` (hidden), `"dashed"` (dash lines), `"filename"` (names only), `"full"` (names + labels) |
| `max_rendered_buffers` | number/nil | `nil` | Maximum buffers to display per page. Pagination is also automatically enabled when buffers exceed available screen height. Uses `min(max_rendered_buffers, available_height)` when set. Navigate pages with `[` and `]` keys. A centered indicator (`● ○ ○`) shows current page. |
Expand Down
2 changes: 2 additions & 0 deletions lua/bento/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -881,6 +881,8 @@ function M.setup(config)
offset_y = 0,
dash_char = "─",
border = "none", -- "rounded" | "single" | "double" | etc. (see :h winborder)
title = nil,
title_pos = "center", -- "left" | "center" | "right" (only applied when title is set)
label_padding = 1,
minimal_menu = nil, -- nil | "dashed" | "filename" | "full"
max_rendered_buffers = nil, -- nil (no limit) or number
Expand Down
21 changes: 17 additions & 4 deletions lua/bento/ui.lua
Original file line number Diff line number Diff line change
Expand Up @@ -503,7 +503,7 @@ local function create_window(height, width)
local row, col = calculate_position(height, width)

local bufnr = vim.api.nvim_create_buf(false, true)
local win_id = vim.api.nvim_open_win(bufnr, false, {
local win_config = {
relative = "editor",
style = "minimal",
width = width,
Expand All @@ -512,7 +512,13 @@ local function create_window(height, width)
col = col,
border = config.ui.floating.border or "none",
focusable = false,
})
title = config.ui.floating.title,
}
if config.ui.floating.title then
win_config.title_pos = config.ui.floating.title_pos
end

local win_id = vim.api.nvim_open_win(bufnr, false, win_config)

vim.api.nvim_buf_set_option(bufnr, "modifiable", false)
vim.api.nvim_buf_set_option(bufnr, "buftype", "nofile")
Expand Down Expand Up @@ -540,13 +546,20 @@ local function update_window_size(width, height)

local row, col = calculate_position(height, width)

pcall(vim.api.nvim_win_set_config, bento_win_id, {
local win_config = {
relative = "editor",
width = width,
height = height,
row = row,
col = col,
})
border = config.ui.floating.border or "none",
title = config.ui.floating.title,
}
if config.ui.floating.title then
win_config.title_pos = config.ui.floating.title_pos
end

pcall(vim.api.nvim_win_set_config, bento_win_id, win_config)
end

--- Check if buffer is active (visible in any window)
Expand Down