feat: buffer len util

This commit is contained in:
əlemi 2024-09-09 05:14:01 +02:00
parent b141ca5a2a
commit 087df96566
Signed by: alemi
GPG key ID: A4895B84D311642C

View file

@ -172,6 +172,13 @@ local function multiline_highlight(buf, ns, group, start, fini)
end end
end end
local function buffer_len(buf)
local count = 0
vim.api.nvim_buf_call(buf, function()
count = vim.fn.wordcount().chars
end)
return count
end
return { return {
multiline_highlight = multiline_highlight, multiline_highlight = multiline_highlight,
@ -179,6 +186,7 @@ return {
position = cursor_position, position = cursor_position,
}, },
buffer = { buffer = {
len = buffer_len,
get_content = buffer_get_content, get_content = buffer_get_content,
set_content = buffer_set_content, set_content = buffer_set_content,
}, },