statusline : add vimode colors
This commit is contained in:
parent
f832195a81
commit
c7fdd68072
|
@ -8,8 +8,8 @@ local t = function(str)
|
|||
end
|
||||
|
||||
local check_back_space = function()
|
||||
local col = vim.fn.col('.') - 1
|
||||
if col == 0 or vim.fn.getline('.'):sub(col, col):match('%s') then
|
||||
local col = vim.fn.col(".") - 1
|
||||
if col == 0 or vim.fn.getline("."):sub(col, col):match("%s") then
|
||||
return true
|
||||
else
|
||||
return false
|
||||
|
@ -24,7 +24,7 @@ _G.tab_complete = function()
|
|||
elseif check_back_space() then
|
||||
return t "<Tab>"
|
||||
else
|
||||
return vim.fn['compe#complete']()
|
||||
return vim.fn["compe#complete"]()
|
||||
end
|
||||
end
|
||||
_G.s_tab_complete = function()
|
||||
|
@ -57,7 +57,6 @@ _G.completions = function()
|
|||
return npairs.check_break_line_char()
|
||||
end
|
||||
|
||||
|
||||
vim.api.nvim_set_keymap("i", "<Tab>", "v:lua.tab_complete()", {expr = true})
|
||||
vim.api.nvim_set_keymap("s", "<Tab>", "v:lua.tab_complete()", {expr = true})
|
||||
vim.api.nvim_set_keymap("i", "<S-Tab>", "v:lua.s_tab_complete()", {expr = true})
|
||||
|
|
|
@ -8,6 +8,9 @@ local gls = gl.section
|
|||
|
||||
gl.short_line_list = {" "}
|
||||
|
||||
local left_separator = "" -- or " "
|
||||
local right_separator = " " -- or ""
|
||||
|
||||
local global_theme = "themes/" .. vim.g.nvchad_theme
|
||||
local colors = require(global_theme)
|
||||
|
||||
|
@ -26,7 +29,7 @@ gls.left[2] = {
|
|||
return " "
|
||||
end,
|
||||
highlight = {colors.statusline_bg, colors.nord_blue},
|
||||
separator = " ",
|
||||
separator = right_separator .. " ",
|
||||
separator_highlight = {colors.nord_blue, colors.lightbg}
|
||||
}
|
||||
}
|
||||
|
@ -44,7 +47,7 @@ gls.left[4] = {
|
|||
provider = {"FileName"},
|
||||
condition = condition.buffer_not_empty,
|
||||
highlight = {colors.white, colors.lightbg},
|
||||
separator = " ",
|
||||
separator = right_separator,
|
||||
separator_highlight = {colors.lightbg, colors.lightbg2}
|
||||
}
|
||||
}
|
||||
|
@ -56,7 +59,7 @@ gls.left[5] = {
|
|||
return " " .. dir_name .. " "
|
||||
end,
|
||||
highlight = {colors.grey_fg2, colors.lightbg2},
|
||||
separator = " ",
|
||||
separator = right_separator,
|
||||
separator_highlight = {colors.lightbg2, colors.statusline_bg}
|
||||
}
|
||||
}
|
||||
|
@ -153,53 +156,71 @@ 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 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
|
||||
end
|
||||
|
||||
gls.right[4] = {
|
||||
viMode_icon = {
|
||||
left_round = {
|
||||
provider = function()
|
||||
return " "
|
||||
vim.cmd("hi Galaxyleft_round guifg=" .. mode(2))
|
||||
return left_separator
|
||||
end,
|
||||
highlight = {colors.statusline_bg, colors.red},
|
||||
separator = " ",
|
||||
separator_highlight = {colors.red, colors.statusline_bg}
|
||||
separator = " ",
|
||||
separator_highlight = {colors.statusline_bg, colors.statusline_bg},
|
||||
highlight = {"GalaxyViMode", colors.statusline_bg}
|
||||
}
|
||||
}
|
||||
|
||||
gls.right[5] = {
|
||||
ViMode = {
|
||||
viMode_icon = {
|
||||
provider = function()
|
||||
local alias = {
|
||||
n = "Normal",
|
||||
i = "Insert",
|
||||
c = "Command",
|
||||
V = "Visual",
|
||||
[""] = "Visual",
|
||||
v = "Visual",
|
||||
R = "Replace"
|
||||
}
|
||||
local current_Mode = alias[vim.fn.mode()]
|
||||
|
||||
if current_Mode == nil then
|
||||
return " Terminal "
|
||||
else
|
||||
return " " .. current_Mode .. " "
|
||||
end
|
||||
vim.cmd("hi GalaxyviMode_icon guibg=" .. mode(2))
|
||||
return " "
|
||||
end,
|
||||
highlight = {colors.red, colors.lightbg}
|
||||
highlight = {colors.statusline_bg, colors.red}
|
||||
}
|
||||
}
|
||||
|
||||
gls.right[6] = {
|
||||
some_icon = {
|
||||
ViMode = {
|
||||
provider = function()
|
||||
vim.cmd("hi GalaxyViMode guifg=" .. mode(2))
|
||||
return " " .. mode(1) .. " "
|
||||
end,
|
||||
highlight = {"GalaxyViMode", colors.lightbg} -- colors.red here will be overriden many times
|
||||
}
|
||||
}
|
||||
|
||||
gls.right[7] = {
|
||||
some_RoundIcon = {
|
||||
provider = function()
|
||||
return " "
|
||||
end,
|
||||
separator = "",
|
||||
separator = left_separator,
|
||||
separator_highlight = {colors.green, colors.lightbg},
|
||||
highlight = {colors.lightbg, colors.green}
|
||||
}
|
||||
}
|
||||
|
||||
gls.right[7] = {
|
||||
gls.right[8] = {
|
||||
line_percentage = {
|
||||
provider = function()
|
||||
local current_line = vim.fn.line(".")
|
||||
|
|
|
@ -12,7 +12,7 @@ local colors = {
|
|||
light_grey = "#646a76",
|
||||
red = "#BF616A",
|
||||
baby_pink = "#de878f",
|
||||
pink = "#e89199",
|
||||
pink = "#d57780",
|
||||
line = "#3a404c", -- for lines like vertsplit
|
||||
green = "#A3BE8C",
|
||||
vibrant_green = "#afca98",
|
||||
|
@ -21,7 +21,7 @@ local colors = {
|
|||
yellow = "#EBCB8B",
|
||||
sun = "#e1c181",
|
||||
purple = "#aab1be",
|
||||
dark_purple = "##B48EAD",
|
||||
dark_purple = "#B48EAD",
|
||||
teal = "#6484a4",
|
||||
orange = "#e39a83",
|
||||
cyan = "#9aafe6",
|
||||
|
|
Loading…
Reference in New Issue