From a096678a84fe5e96e36ed7e817e80bf8a56e7740 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gutyina=20Gerg=C5=91?= Date: Sun, 9 Jun 2024 21:56:09 +0200 Subject: [PATCH 1/3] docs: fix lua syntax error --- doc/bufferline.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/bufferline.txt b/doc/bufferline.txt index 2e27e21c..00e72e11 100644 --- a/doc/bufferline.txt +++ b/doc/bufferline.txt @@ -573,7 +573,7 @@ A user can also execute arbitrary functions against a buffer using the function _G.bdel(num) require('bufferline').exec(num, function(buf, visible_buffers) vim.cmd('bdelete '..buf.id) - end + end) end vim.cmd [[ From 9fedfd15a6bb4683dc894e8d8e4fa98489fea2fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gutyina=20Gerg=C5=91?= Date: Tue, 11 Jun 2024 00:04:24 +0200 Subject: [PATCH 2/3] docs: fix custom_areas example Previously a new highlight was created and cached for each index. For example when the result table only has a warning, an orange color highlight will be created and cached for index 1. Then the user fixes the warning but generates an error with index 1, the orange color will be reused from the cache rather than creating a highlight for the associated red color. Using an existing highlight with link will avoid using that cache entirely. --- doc/bufferline.txt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/doc/bufferline.txt b/doc/bufferline.txt index 00e72e11..6626fc89 100644 --- a/doc/bufferline.txt +++ b/doc/bufferline.txt @@ -1126,19 +1126,19 @@ to be shown in a list of tables. For example: local hint = #vim.diagnostic.get(0, {severity = seve.HINT}) if error ~= 0 then - table.insert(result, {text = "  " .. error, fg = "#EC5241"}) + table.insert(result, {text = "  " .. error, link = "DiagnosticError"}) end if warning ~= 0 then - table.insert(result, {text = "  " .. warning, fg = "#EFB839"}) + table.insert(result, {text = "  " .. warning, link = "DiagnosticWarn"}) end if hint ~= 0 then - table.insert(result, {text = "  " .. hint, fg = "#A3BA5E"}) + table.insert(result, {text = "  " .. hint, link = "DiagnosticHint"}) end if info ~= 0 then - table.insert(result, {text = "  " .. info, fg = "#7EA9A7"}) + table.insert(result, {text = "  " .. info, link = "DiagnosticInfo"}) end return result end, From 5e7687afc9075a3213c9b7759f2bc63cab74ee12 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gutyina=20Gerg=C5=91?= Date: Sun, 9 Jun 2024 22:50:45 +0200 Subject: [PATCH 3/3] docs: fix sort_by function example `buffer_a.modified` returned a bool rather than a number. --- doc/bufferline.txt | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/doc/bufferline.txt b/doc/bufferline.txt index 6626fc89..6da2644f 100644 --- a/doc/bufferline.txt +++ b/doc/bufferline.txt @@ -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 } } @@ -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 <