From 2bc134a5634c2023233aba7dc2d99cbb9000c277 Mon Sep 17 00:00:00 2001 From: Taken Date: Fri, 22 Mar 2024 00:30:16 +0100 Subject: [PATCH] Fixed mode colors for visual block mode Added buffer count for lualine --- lua/taken/plugins/lualine.lua | 38 +++++++++++++++++++++++++++++++---- 1 file changed, 34 insertions(+), 4 deletions(-) diff --git a/lua/taken/plugins/lualine.lua b/lua/taken/plugins/lualine.lua index 344f03c..23fca9d 100644 --- a/lua/taken/plugins/lualine.lua +++ b/lua/taken/plugins/lualine.lua @@ -28,18 +28,17 @@ return { end, } - -- FIXME: fix visual block mode not showing properly local mode_color = { n = colors.red, i = colors.green, v = colors.blue, - [""] = colors.blue, + [""] = colors.blue, V = colors.blue, c = colors.magenta, no = colors.red, s = colors.orange, S = colors.orange, - [""] = colors.orange, + [""] = colors.orange, ic = colors.yellow, R = colors.violet, Rv = colors.violet, @@ -146,6 +145,9 @@ return { removed = { fg = colors.red, bg = "None" }, }, cond = conditions.hide_in_width, + on_click = function() + vim.cmd("Neogit") + end, } local fileformat = { "fileformat", @@ -177,6 +179,34 @@ return { vim.cmd("Mason") end, } + local buffers = { + function() + 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 == 0 then + return "No buffs" + elseif bufNumb == 1 then + return bufNumb .. " buff" + else + return bufNumb .. " buffs" + end + end, + color = { fg = colors.darkblue, bg = "None" }, + on_click = function() + require("buffer_manager.ui").toggle_quick_menu() + end, + } local filetype = { "filetype", color = { fg = colors.darkblue, bg = "None" }, @@ -259,7 +289,7 @@ return { lualine_b = { filename, branch }, lualine_c = { diagnostics, sep, harpoon }, lualine_x = { copilot, diff, fileformat, lazy, mason }, - lualine_y = { filetype, progress }, + lualine_y = { buffers, filetype, progress }, lualine_z = { location }, }, inactive_sections = {