Updated buffer display

This commit is contained in:
2025-04-29 11:02:13 +02:00
parent dd664b31d9
commit 21b697c7c3

View File

@@ -87,6 +87,26 @@ return {
return "󰑋 " .. recording_register return "󰑋 " .. recording_register
end end
end end
local function get_buffers()
local bufs = vim.api.nvim_list_bufs()
local bufNumb = 0
local function buffer_is_valid(buf_id, buf_name)
return 1 == vim.fn.buflisted(buf_id) and buf_name ~= ""
end
for idx = 1, #bufs do
local buf_id = bufs[idx]
local buf_name = vim.api.nvim_buf_get_name(buf_id)
if buffer_is_valid(buf_id, buf_name) then
bufNumb = bufNumb + 1
end
end
if bufNumb == 1 then
return bufNumb .. ""
else
return bufNumb .. ""
end
end
local mode = { local mode = {
"mode", "mode",
@@ -199,26 +219,7 @@ return {
end, end,
} }
local buffers = { local buffers = {
function() get_buffers(),
local bufs = vim.api.nvim_list_bufs()
local bufNumb = 0
local function buffer_is_valid(buf_id, buf_name)
return 1 == vim.fn.buflisted(buf_id) and buf_name ~= ""
end
for idx = 1, #bufs do
local buf_id = bufs[idx]
local buf_name = vim.api.nvim_buf_get_name(buf_id)
if buffer_is_valid(buf_id, buf_name) then
bufNumb = bufNumb + 1
end
end
if bufNumb == 1 then
return bufNumb .. ""
else
return bufNumb .. ""
end
end,
color = { fg = colors.darkblue, bg = "None" }, color = { fg = colors.darkblue, bg = "None" },
on_click = function() on_click = function()
require("buffer_manager.ui").toggle_quick_menu() require("buffer_manager.ui").toggle_quick_menu()
@@ -260,12 +261,12 @@ return {
lualine_z = { location }, lualine_z = { location },
}, },
inactive_sections = { inactive_sections = {
lualine_a = { "filename" }, lualine_a = { filename },
lualine_b = {}, lualine_b = {},
lualine_c = {}, lualine_c = {},
lualine_x = {}, lualine_x = {},
lualine_y = {}, lualine_y = {},
lualine_z = { "location" }, lualine_z = { location },
}, },
tabline = {}, tabline = {},
extensions = {}, extensions = {},