From fafa7342ceb355ecc4b67b4183ad0941e7e12eb8 Mon Sep 17 00:00:00 2001 From: SinTan1729 Date: Wed, 27 Mar 2024 19:48:46 -0500 Subject: [PATCH] new: Show total lines in lualine using custom fn --- laptop/plugin/lualine.lua | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/laptop/plugin/lualine.lua b/laptop/plugin/lualine.lua index 189368d..24b18b2 100644 --- a/laptop/plugin/lualine.lua +++ b/laptop/plugin/lualine.lua @@ -1,3 +1,14 @@ +local function total_lines() + local lc = vim.fn.line('$') + if lc < 1 then + return '' + elseif lc == 1 then + return '(1 line)' + else + return string.format('(%d lines)', lc) + end +end + require("lualine").setup { options = { theme = 'moonfly', @@ -6,8 +17,8 @@ require("lualine").setup { lualine_a = { 'buffers' }, lualine_b = {}, lualine_c = {}, - lualine_x = {}, - lualine_y = { 'filename' }, + lualine_x = { 'filename' }, + lualine_y = { total_lines }, lualine_z = { 'tabs' }, }, sections = {