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