From d98842295fd3d8f9890546fb87b3d550fe64d815 Mon Sep 17 00:00:00 2001 From: Fernando Schauenburg Date: Thu, 10 Feb 2022 00:35:31 +0100 Subject: [PATCH] vim: add nice progress bar to statusline --- config/nvim/lua/fs/config/lualine.lua | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/config/nvim/lua/fs/config/lualine.lua b/config/nvim/lua/fs/config/lualine.lua index a2eccaf..4bcd4bf 100644 --- a/config/nvim/lua/fs/config/lualine.lua +++ b/config/nvim/lua/fs/config/lualine.lua @@ -80,7 +80,20 @@ local parts = { }, }, - progress = '%3l/%L,%-2v', -- line / total |column + location = '%L𝓁 %3l:%-2v', + + progress = { + function() + local chars = { '█', '▇', '▆', '▅', '▄', '▃', '▂', '▁', ' ' } + local current, total = vim.fn.line '.', vim.fn.line '$' + return chars[math.ceil(#chars * current / total)] + end, + padding = 0, + color = { + fg = theme.normal.b.bg, + bg = theme.normal.c.bg, + }, + }, } local sections = Table:new { @@ -89,7 +102,7 @@ local sections = Table:new { lualine_c = { parts.relative_path }, lualine_x = { 'diagnostics', 'filetype' }, lualine_y = { parts.encoding, parts.fileformat }, - lualine_z = { parts.progress }, + lualine_z = { parts.location }, } local config = function() @@ -103,6 +116,7 @@ local config = function() sections = sections:override { lualine_a = { 'mode', parts.paste }, + lualine_y = { parts.encoding, parts.fileformat, parts.progress }, }, inactive_sections = sections,