Skip to content

Commit

Permalink
feat: Support name_formatter for unnamed buffers (#806)
Browse files Browse the repository at this point in the history
  • Loading branch information
mskelton committed Aug 29, 2023
1 parent 417b303 commit 9961d87
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions lua/bufferline/models.lua
Original file line number Diff line number Diff line change
Expand Up @@ -176,10 +176,12 @@ function Buffer:new(buf)
if buf.path and #buf.path > 0 then
name = fn.fnamemodify(buf.path, ":t")
name = is_directory and name .. "/" or name
if buf.name_formatter and type(buf.name_formatter) == "function" then
name = buf.name_formatter({ name = name, path = buf.path, bufnr = buf.id }) or name
end
end

if buf.name_formatter and type(buf.name_formatter) == "function" then
name = buf.name_formatter({ name = name, path = buf.path, bufnr = buf.id }) or name
end

buf.name = name

setmetatable(buf, self)
Expand Down

0 comments on commit 9961d87

Please sign in to comment.