Skip to content

Commit

Permalink
docs: fix sort_by function example
Browse files Browse the repository at this point in the history
`buffer_a.modified` returned a bool rather than a number.
  • Loading branch information
gepbird committed Jul 18, 2024
1 parent 9fedfd1 commit 5e7687a
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions doc/bufferline.txt
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,9 @@ The available configuration are:
},
sort_by = 'insert_after_current' |'insert_at_end' | 'id' | 'extension' | 'relative_directory' | 'directory' | 'tabs' | function(buffer_a, buffer_b)
-- add custom logic
return buffer_a.modified > buffer_b.modified
local modified_a = vim.fn.getftime(buffer_a.path)
local modified_b = vim.fn.getftime(buffer_b.path)
return modified_a > modified_b
end
}
}
Expand Down Expand Up @@ -483,7 +485,9 @@ are available to use using >lua
sort_by = function(buffer_a, buffer_b)
print(vim.inspect(buffer_a))
-- add custom logic
return buffer_a.modified > buffer_b.modified
local modified_a = vim.fn.getftime(buffer_a.path)
local modified_b = vim.fn.getftime(buffer_b.path)
return modified_a > modified_b
end
<

Expand Down

0 comments on commit 5e7687a

Please # to comment.