Skip to content

Commit 03df014

Browse files
author
José Morano
committed
[Fixes #37] Added 'fullpath' option for 'order_buffers'.
1 parent 08e31cf commit 03df014

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ require("buffer_manager").setup({ })
106106
* `win_extra_options` (table): extra options for the menu window. E.g. `{ relativenumber = true }`. (See `:help option-list`.)
107107
* `borderchars` (table): border characters for the menu window.
108108
* `format_function` (function|nil): support for custom function to format buffer names. The function should receive a string and return a string. This option is incompatible with `short_file_names`. To use it, `short_file_names` must be set to `false`. By default, the function is `nil`, which means no special formatting is applied.
109-
* `order_buffers` (string|nil): order the buffers in the menu. Options are `"filename"`, `"bufnr"` and `"lastused"`. By default, it is `nil`, which means the buffers are not automatically ordered. If `reverse` is added to the option, the buffers are ordered in reverse order. For example, `order_buffers = 'filename:reverse'`.
109+
* `order_buffers` (string|nil): order the buffers in the menu. Options are `"filename"`, `"bufnr"`, `"lastused"` and `"fullpath"`. By default, it is `nil`, which means the buffers are not automatically ordered. If `reverse` is added to the option, the buffers are ordered in reverse order. For example, `order_buffers = 'filename:reverse'`.
110110
* `show_indicators` (string|nil): show indicators for buffers in virtual text. See `:help ls` for more information about indicators. Possible values are `"before"` (before filename) and `"after"` (after filename). When set to `nil`, no indicators are shown.
111111

112112

lua/buffer_manager/ui.lua

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,12 @@ local function order_buffers()
171171
local b_name = string.lower(utils.get_file_name(b.filename))
172172
return a_name < b_name
173173
end)
174+
elseif string_starts(config.order_buffers, "fullpath") then
175+
table.sort(marks, function(a, b)
176+
local a_name = string.lower(a.filename)
177+
local b_name = string.lower(b.filename)
178+
return a_name < b_name
179+
end)
174180
elseif string_starts(config.order_buffers, "bufnr") then
175181
table.sort(marks, function(a, b)
176182
return a.buf_id < b.buf_id

0 commit comments

Comments
 (0)