From 50d8872931632970831a6b669cbdaa30288efddb Mon Sep 17 00:00:00 2001 From: Michael Peters Date: Wed, 5 Oct 2022 20:48:07 -0700 Subject: [PATCH 1/2] show lualine on inactive buffers --- lua/configs/lualine.lua | 84 ++++++++++++++++++++++++++++++++++++----- 1 file changed, 74 insertions(+), 10 deletions(-) diff --git a/lua/configs/lualine.lua b/lua/configs/lualine.lua index a018d44..e70c78a 100644 --- a/lua/configs/lualine.lua +++ b/lua/configs/lualine.lua @@ -61,18 +61,12 @@ function M.config() lualine_a = {}, lualine_b = {}, lualine_c = { - { -- git branch - "branch", - icon = "", - color = { fg = scolors.branch, gui = "bold" }, - padding = { left = 2, right = 1 }, - }, { -- filetype "filetype", colored = false, color = { fg = scolors.filetype, gui = "bold" }, cond = conditions.buffer_not_empty, - padding = { left = 1, right = 1 }, + padding = { left = 2, right = 1 }, }, { -- file name "filename", @@ -101,6 +95,12 @@ function M.config() }, padding = { left = 2, right = 1 }, }, + { -- git branch + "branch", + icon = "", + color = { fg = scolors.branch, gui = "bold" }, + padding = { left = 1, right = 1 }, + }, }, lualine_x = { { -- git blame @@ -139,11 +139,75 @@ function M.config() inactive_sections = { lualine_a = {}, lualine_b = {}, - lualine_c = {}, - lualine_x = {}, + lualine_c = { + { -- filetype + "filetype", + colored = false, + color = { fg = scolors.filetype, gui = "bold" }, + cond = conditions.buffer_not_empty, + padding = { left = 2, right = 1 }, + }, + { -- file name + "filename", + color = { fg = scolors.filename, gui = "bold" }, + padding = { left = 1, right = 1 }, + }, + { -- git diff + "diff", + symbols = { added = " ", modified = "柳", removed = " " }, + diff_color = { + added = { fg = scolors.added }, + modified = { fg = scolors.modified }, + removed = { fg = scolors.removed }, + }, + cond = conditions.hide_in_width, + padding = { left = 1, right = 1 }, + }, + { -- nvim diagnostics + "diagnostics", + sources = { "nvim_diagnostic" }, + symbols = { error = " ", warn = " ", info = " ", hint = " " }, + diagnostics_color = { + color_error = { fg = scolors.error }, + color_warn = { fg = scolors.warn }, + color_info = { fg = scolors.info }, + }, + padding = { left = 2, right = 1 }, + }, + { -- git branch + "branch", + icon = "", + padding = { left = 1, right = 1 }, + }, + }, + lualine_x = { + { -- location in file (line:col) + "location", + padding = { left = 0, right = 1 }, + }, + { -- progress through file (%) + -- slightly modified from default "progress" + -- always 3 chars long, no TOP + -- https://github.com/nvim-lualine/lualine.nvim/blob/master/lua/lualine/components/progress.lua + function () + local cur = vim.fn.line('.') + local total = vim.fn.line('$') + if cur == total then + return 'BOT' + elseif cur / total < 0.10 then + return ' ' .. math.floor(cur / total * 100) .. '%%' + else + return math.floor(cur / total * 100) .. '%%' + end + end, + "progress", + color = { gui = "none" }, + padding = { left = 0, right = 1 }, + }, + }, lualine_y = {}, lualine_z = {}, - }, + } } lualine.setup(config) From 7cf819138d83e794c9ff4e1e848c4a94c441ccfe Mon Sep 17 00:00:00 2001 From: Michael Peters Date: Wed, 5 Oct 2022 21:18:15 -0700 Subject: [PATCH 2/2] change lualine padding --- lua/configs/lualine.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lua/configs/lualine.lua b/lua/configs/lualine.lua index e70c78a..176ecb2 100644 --- a/lua/configs/lualine.lua +++ b/lua/configs/lualine.lua @@ -93,7 +93,7 @@ function M.config() color_warn = { fg = scolors.warn }, color_info = { fg = scolors.info }, }, - padding = { left = 2, right = 1 }, + padding = { left = 1, right = 1 }, }, { -- git branch "branch", @@ -172,7 +172,7 @@ function M.config() color_warn = { fg = scolors.warn }, color_info = { fg = scolors.info }, }, - padding = { left = 2, right = 1 }, + padding = { left = 1, right = 1 }, }, { -- git branch "branch",