From d8a5afedcf09b14e28a32980adb2f2e5ef144c1f Mon Sep 17 00:00:00 2001 From: Nate Date: Thu, 5 Feb 2026 14:46:19 +0100 Subject: [PATCH 1/4] docs: hack path name in menu --- README.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/README.md b/README.md index 4d35b0a..1cdb62b 100644 --- a/README.md +++ b/README.md @@ -400,6 +400,21 @@ actions = { } ``` +### Custom Display Names +```lua + local butils = require("bento.utils") + + -- Change from ~/home/yak/file.lua -> ~/h/y/file.lua + butils.get_display_names = function(paths) + local display_names = {} + for _, p in ipairs(paths) do + display_names[p] = vim.fn.pathshorten(vim.fn.fnamemodify(p, ":~:."), 1) + end + return display_names + end + require("bento").setup(opts) +``` + ## Acknowledgments & inspiration - [buffer-sticks.nvim](https://github.com/ahkohd/buffer-sticks.nvim) by [`ahkohd`](https://github.com/ahkohd): this plugin inspired some of the ideas implemented in `bento` (e.g., the dashed menu). You should also check out this plugin, it's very good and it pursues solutions to many of the same problems. From d720e753697d409c6be8bff7d2e7f02a39e356ec Mon Sep 17 00:00:00 2001 From: Nate Date: Thu, 5 Feb 2026 14:57:38 +0100 Subject: [PATCH 2/4] docs should clarify the default shortening convention --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 1cdb62b..c5df2a9 100644 --- a/README.md +++ b/README.md @@ -405,6 +405,7 @@ actions = { local butils = require("bento.utils") -- Change from ~/home/yak/file.lua -> ~/h/y/file.lua + -- by default this is displayed as file.lua butils.get_display_names = function(paths) local display_names = {} for _, p in ipairs(paths) do From ce252334ae44c82063714426a8c8c9f7395cf7c2 Mon Sep 17 00:00:00 2001 From: nate Date: Sun, 22 Feb 2026 17:58:23 +0100 Subject: [PATCH 3/4] center --- lua/bento/ui.lua | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lua/bento/ui.lua b/lua/bento/ui.lua index d331558..f0821ad 100644 --- a/lua/bento/ui.lua +++ b/lua/bento/ui.lua @@ -476,6 +476,12 @@ local function calculate_position(height, width) local row, col + if position:match("center") then + row = math.floor((ui.height - height) / 2) + col = math.floor((ui.width - width) / 2) + return row + offset_y, col + offset_x + end + -- Vertical positioning if position:match("^top") then row = 0 From 1677a6ec2ffbda171a7b6c4c7fe24508bfb0ef39 Mon Sep 17 00:00:00 2001 From: Nate Date: Mon, 23 Feb 2026 17:06:48 +0100 Subject: [PATCH 4/4] middle stuff --- lua/bento/ui.lua | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/lua/bento/ui.lua b/lua/bento/ui.lua index f0821ad..6f45757 100644 --- a/lua/bento/ui.lua +++ b/lua/bento/ui.lua @@ -219,7 +219,10 @@ local function update_marks() local a_val = bento.get_ordering_value(a.buf_id) local b_val = bento.get_ordering_value(b.buf_id) - if ordering_metric == "filename" or ordering_metric == "directory" then + if + ordering_metric == "filename" + or ordering_metric == "directory" + then -- String comparison: ascending alphabetical if a_val == b_val then return a.buf_id < b.buf_id @@ -476,17 +479,25 @@ local function calculate_position(height, width) local row, col - if position:match("center") then + if position:match("^middle") then row = math.floor((ui.height - height) / 2) col = math.floor((ui.width - width) / 2) - return row + offset_y, col + offset_x + return row + offset_x, col + offset_y end -- Vertical positioning if position:match("^top") then row = 0 + if position:match("middle$") then + col = math.floor((ui.width - width) / 2) + return row + offset_x, col + offset_y + end elseif position:match("^bottom") then row = ui.height - height + if position:match("middle$") then + col = math.floor((ui.width - width) / 2) + return row + offset_x, col + offset_y + end else row = math.floor((ui.height - height) / 2) end