From ebdcd4cae1b61dc52c975c65f80489d664c9f047 Mon Sep 17 00:00:00 2001 From: siduck76 Date: Sat, 14 Aug 2021 22:35:10 +0530 Subject: [PATCH] fix luasnip creating statusline errors (#250) --- lua/plugins/statusline.lua | 32 ++++++++++++++------------------ 1 file changed, 14 insertions(+), 18 deletions(-) diff --git a/lua/plugins/statusline.lua b/lua/plugins/statusline.lua index bbc49ae8..e74bea94 100644 --- a/lua/plugins/statusline.lua +++ b/lua/plugins/statusline.lua @@ -156,25 +156,21 @@ gls.right[3] = { } } -local active_mode = { - n = {"Normal", colors.red}, - i = {"Insert", colors.dark_purple}, - c = {"Command", colors.pink}, - V = {"Visual", colors.cyan}, - [""] = {"Visual", colors.cyan}, - v = {"Visual", colors.cyan}, - R = {"Replace", colors.orange}, - t = {"Terminal", colors.green} +local mode_colors = { + [110] = {"NORMAL", colors.red}, + [105] = {"INSERT", colors.dark_purple}, + [99] = {"COMMAND", colors.pink}, + [116] = {"TERMINAL", colors.green}, + [118] = {"VISUAL", colors.cyan}, + [22] = {"V-BLOCK", colors.cyan}, + [86] = {"V_LINE", colors.cyan}, + [82] = {"REPLACE", colors.orange}, + [115] = {"SELECT", colors.nord_blue}, + [83] = {"S-LINE", colors.nord_blue} } -local function mode(m) - local chad_mode = active_mode[vim.fn.mode()][m] - - if chad_mode == "nil" then - return active_mode[vim.fn.mode()]["t"] - else - return chad_mode - end +local mode = function(n) + return mode_colors[vim.fn.mode():byte()][n] end gls.right[4] = { @@ -205,7 +201,7 @@ gls.right[6] = { vim.cmd("hi GalaxyViMode guifg=" .. mode(2)) return " " .. mode(1) .. " " end, - highlight = {"GalaxyViMode", colors.lightbg} -- colors.red here will be overriden many times + highlight = {"GalaxyViMode", colors.lightbg} } }