From ac28a9f99eabc8918794d59b45fda511344f9625 Mon Sep 17 00:00:00 2001 From: siduck76 Date: Sun, 26 Sep 2021 15:53:50 +0530 Subject: [PATCH] fix : shortline for small screens (#468) --- lua/plugins/configs/statusline.lua | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/lua/plugins/configs/statusline.lua b/lua/plugins/configs/statusline.lua index d485e6f..1b45878 100644 --- a/lua/plugins/configs/statusline.lua +++ b/lua/plugins/configs/statusline.lua @@ -84,6 +84,9 @@ components.active[1][2] = { end return " " .. icon .. " " .. filename .. " " end, + enabled = function(winid) + return vim.api.nvim_win_get_width(winid) > 70 + end, hl = { fg = colors.white, bg = colors.lightbg, @@ -98,6 +101,10 @@ components.active[1][3] = { return "  " .. dir_name .. " " end, + enabled = function(winid) + return vim.api.nvim_win_get_width(winid) > 80 + end, + hl = { fg = colors.grey_fg2, bg = colors.lightbg2, @@ -143,6 +150,7 @@ components.active[1][7] = { enabled = function() return lsp.diagnostics_exist "Error" end, + hl = { fg = colors.red }, icon = "  ", } @@ -204,6 +212,9 @@ components.active[2][1] = { end return "" end, + enabled = function(winid) + return vim.api.nvim_win_get_width(winid) > 80 + end, hl = { fg = colors.green }, } @@ -215,11 +226,17 @@ components.active[3][1] = { return "" end end, + enabled = function(winid) + return vim.api.nvim_win_get_width(winid) > 70 + end, hl = { fg = colors.grey_fg2, bg = colors.statusline_bg }, } components.active[3][2] = { provider = "git_branch", + enabled = function(winid) + return vim.api.nvim_win_get_width(winid) > 70 + end, hl = { fg = colors.grey_fg2, bg = colors.statusline_bg, @@ -294,6 +311,9 @@ components.active[3][6] = { components.active[3][7] = { provider = statusline_style.left, + enabled = function(winid) + return vim.api.nvim_win_get_width(winid) > 90 + end, hl = { fg = colors.grey, bg = colors.one_bg, @@ -302,6 +322,9 @@ components.active[3][7] = { components.active[3][8] = { provider = statusline_style.left, + enabled = function(winid) + return vim.api.nvim_win_get_width(winid) > 90 + end, hl = { fg = colors.green, bg = colors.grey, @@ -310,6 +333,9 @@ components.active[3][8] = { components.active[3][9] = { provider = statusline_style.position_icon, + enabled = function(winid) + return vim.api.nvim_win_get_width(winid) > 90 + end, hl = { fg = colors.black, bg = colors.green, @@ -330,6 +356,10 @@ components.active[3][10] = { return " " .. result .. "%% " end, + enabled = function(winid) + return vim.api.nvim_win_get_width(winid) > 90 + end, + hl = { fg = colors.green, bg = colors.one_bg,