|
|
@ -1,8 +1,16 @@
|
|
|
|
local colors = require("colors").get()
|
|
|
|
local present, feline = pcall(require, "feline")
|
|
|
|
local lsp = require "feline.providers.lsp"
|
|
|
|
if not present then
|
|
|
|
local lsp_severity = vim.diagnostic.severity
|
|
|
|
return
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
local default = {
|
|
|
|
|
|
|
|
colors = require("colors").get(),
|
|
|
|
|
|
|
|
lsp = require "feline.providers.lsp",
|
|
|
|
|
|
|
|
lsp_severity = vim.diagnostic.severity,
|
|
|
|
|
|
|
|
config = require("core.utils").load_config().plugins.options.statusline,
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
local icon_styles = {
|
|
|
|
default.icon_styles = {
|
|
|
|
default = {
|
|
|
|
default = {
|
|
|
|
left = "",
|
|
|
|
left = "",
|
|
|
|
right = " ",
|
|
|
|
right = " ",
|
|
|
@ -43,35 +51,35 @@ local icon_styles = {
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
local config = require("core.utils").load_config().plugins.options.statusline
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- statusline style
|
|
|
|
-- statusline style
|
|
|
|
local user_statusline_style = config.style
|
|
|
|
default.statusline_style = default.icon_styles[default.config.style]
|
|
|
|
local statusline_style = icon_styles[user_statusline_style]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- show short statusline on small screens
|
|
|
|
-- show short statusline on small screens
|
|
|
|
local shortline = config.shortline == false and true
|
|
|
|
default.shortline = default.config.shortline == false and true
|
|
|
|
|
|
|
|
|
|
|
|
-- Initialize the components table
|
|
|
|
-- Initialize the components table
|
|
|
|
local components = {
|
|
|
|
default.components = {
|
|
|
|
active = {},
|
|
|
|
active = {},
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
local main_icon = {
|
|
|
|
default.main_icon = {
|
|
|
|
provider = statusline_style.main_icon,
|
|
|
|
provider = default.statusline_style.main_icon,
|
|
|
|
|
|
|
|
|
|
|
|
hl = {
|
|
|
|
hl = {
|
|
|
|
fg = colors.statusline_bg,
|
|
|
|
fg = default.colors.statusline_bg,
|
|
|
|
bg = colors.nord_blue,
|
|
|
|
bg = default.colors.nord_blue,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
right_sep = { str = statusline_style.right, hl = {
|
|
|
|
right_sep = {
|
|
|
|
fg = colors.nord_blue,
|
|
|
|
str = default.statusline_style.right,
|
|
|
|
bg = colors.lightbg,
|
|
|
|
hl = {
|
|
|
|
} },
|
|
|
|
fg = default.colors.nord_blue,
|
|
|
|
|
|
|
|
bg = default.colors.lightbg,
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
},
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
local file_name = {
|
|
|
|
default.file_name = {
|
|
|
|
provider = function()
|
|
|
|
provider = function()
|
|
|
|
local filename = vim.fn.expand "%:t"
|
|
|
|
local filename = vim.fn.expand "%:t"
|
|
|
|
local extension = vim.fn.expand "%:e"
|
|
|
|
local extension = vim.fn.expand "%:e"
|
|
|
@ -82,46 +90,49 @@ local file_name = {
|
|
|
|
end
|
|
|
|
end
|
|
|
|
return " " .. icon .. " " .. filename .. " "
|
|
|
|
return " " .. icon .. " " .. filename .. " "
|
|
|
|
end,
|
|
|
|
end,
|
|
|
|
enabled = shortline or function(winid)
|
|
|
|
enabled = default.shortline or function(winid)
|
|
|
|
return vim.api.nvim_win_get_width(tonumber(winid) or 0) > 70
|
|
|
|
return vim.api.nvim_win_get_width(tonumber(winid) or 0) > 70
|
|
|
|
end,
|
|
|
|
end,
|
|
|
|
hl = {
|
|
|
|
hl = {
|
|
|
|
fg = colors.white,
|
|
|
|
fg = default.colors.white,
|
|
|
|
bg = colors.lightbg,
|
|
|
|
bg = default.colors.lightbg,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
right_sep = { str = statusline_style.right, hl = { fg = colors.lightbg, bg = colors.lightbg2 } },
|
|
|
|
right_sep = {
|
|
|
|
|
|
|
|
str = default.statusline_style.right,
|
|
|
|
|
|
|
|
hl = { fg = default.colors.lightbg, bg = default.colors.lightbg2 },
|
|
|
|
|
|
|
|
},
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
local dir_name = {
|
|
|
|
default.dir_name = {
|
|
|
|
provider = function()
|
|
|
|
provider = function()
|
|
|
|
local dir_name = vim.fn.fnamemodify(vim.fn.getcwd(), ":t")
|
|
|
|
local dir_name = vim.fn.fnamemodify(vim.fn.getcwd(), ":t")
|
|
|
|
return " " .. dir_name .. " "
|
|
|
|
return " " .. dir_name .. " "
|
|
|
|
end,
|
|
|
|
end,
|
|
|
|
|
|
|
|
|
|
|
|
enabled = shortline or function(winid)
|
|
|
|
enabled = default.shortline or function(winid)
|
|
|
|
return vim.api.nvim_win_get_width(tonumber(winid) or 0) > 80
|
|
|
|
return vim.api.nvim_win_get_width(tonumber(winid) or 0) > 80
|
|
|
|
end,
|
|
|
|
end,
|
|
|
|
|
|
|
|
|
|
|
|
hl = {
|
|
|
|
hl = {
|
|
|
|
fg = colors.grey_fg2,
|
|
|
|
fg = default.colors.grey_fg2,
|
|
|
|
bg = colors.lightbg2,
|
|
|
|
bg = default.colors.lightbg2,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
right_sep = {
|
|
|
|
right_sep = {
|
|
|
|
str = statusline_style.right,
|
|
|
|
str = default.statusline_style.right,
|
|
|
|
hi = {
|
|
|
|
hi = {
|
|
|
|
fg = colors.lightbg2,
|
|
|
|
fg = default.colors.lightbg2,
|
|
|
|
bg = colors.statusline_bg,
|
|
|
|
bg = default.colors.statusline_bg,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
local diff = {
|
|
|
|
default.diff = {
|
|
|
|
add = {
|
|
|
|
add = {
|
|
|
|
provider = "git_diff_added",
|
|
|
|
provider = "git_diff_added",
|
|
|
|
hl = {
|
|
|
|
hl = {
|
|
|
|
fg = colors.grey_fg2,
|
|
|
|
fg = default.colors.grey_fg2,
|
|
|
|
bg = colors.statusline_bg,
|
|
|
|
bg = default.colors.statusline_bg,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
icon = " ",
|
|
|
|
icon = " ",
|
|
|
|
},
|
|
|
|
},
|
|
|
@ -129,8 +140,8 @@ local diff = {
|
|
|
|
change = {
|
|
|
|
change = {
|
|
|
|
provider = "git_diff_changed",
|
|
|
|
provider = "git_diff_changed",
|
|
|
|
hl = {
|
|
|
|
hl = {
|
|
|
|
fg = colors.grey_fg2,
|
|
|
|
fg = default.colors.grey_fg2,
|
|
|
|
bg = colors.statusline_bg,
|
|
|
|
bg = default.colors.statusline_bg,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
icon = " ",
|
|
|
|
icon = " ",
|
|
|
|
},
|
|
|
|
},
|
|
|
@ -138,65 +149,65 @@ local diff = {
|
|
|
|
remove = {
|
|
|
|
remove = {
|
|
|
|
provider = "git_diff_removed",
|
|
|
|
provider = "git_diff_removed",
|
|
|
|
hl = {
|
|
|
|
hl = {
|
|
|
|
fg = colors.grey_fg2,
|
|
|
|
fg = default.colors.grey_fg2,
|
|
|
|
bg = colors.statusline_bg,
|
|
|
|
bg = default.colors.statusline_bg,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
icon = " ",
|
|
|
|
icon = " ",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
local git_branch = {
|
|
|
|
default.git_branch = {
|
|
|
|
provider = "git_branch",
|
|
|
|
provider = "git_branch",
|
|
|
|
enabled = shortline or function(winid)
|
|
|
|
enabled = default.shortline or function(winid)
|
|
|
|
return vim.api.nvim_win_get_width(tonumber(winid) or 0) > 70
|
|
|
|
return vim.api.nvim_win_get_width(tonumber(winid) or 0) > 70
|
|
|
|
end,
|
|
|
|
end,
|
|
|
|
hl = {
|
|
|
|
hl = {
|
|
|
|
fg = colors.grey_fg2,
|
|
|
|
fg = default.colors.grey_fg2,
|
|
|
|
bg = colors.statusline_bg,
|
|
|
|
bg = default.colors.statusline_bg,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
icon = " ",
|
|
|
|
icon = " ",
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
local diagnostic = {
|
|
|
|
default.diagnostic = {
|
|
|
|
errors = {
|
|
|
|
errors = {
|
|
|
|
provider = "diagnostic_errors",
|
|
|
|
provider = "diagnostic_errors",
|
|
|
|
enabled = function()
|
|
|
|
enabled = function()
|
|
|
|
return lsp.diagnostics_exist(lsp_severity.ERROR)
|
|
|
|
return default.lsp.diagnostics_exist(default.lsp_severity.ERROR)
|
|
|
|
end,
|
|
|
|
end,
|
|
|
|
|
|
|
|
|
|
|
|
hl = { fg = colors.red },
|
|
|
|
hl = { fg = default.colors.red },
|
|
|
|
icon = " ",
|
|
|
|
icon = " ",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
warning = {
|
|
|
|
warning = {
|
|
|
|
provider = "diagnostic_warnings",
|
|
|
|
provider = "diagnostic_warnings",
|
|
|
|
enabled = function()
|
|
|
|
enabled = function()
|
|
|
|
return lsp.diagnostics_exist(lsp_severity.WARN)
|
|
|
|
return default.lsp.diagnostics_exist(default.lsp_severity.WARN)
|
|
|
|
end,
|
|
|
|
end,
|
|
|
|
hl = { fg = colors.yellow },
|
|
|
|
hl = { fg = default.colors.yellow },
|
|
|
|
icon = " ",
|
|
|
|
icon = " ",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
hint = {
|
|
|
|
hint = {
|
|
|
|
provider = "diagnostic_hints",
|
|
|
|
provider = "diagnostic_hints",
|
|
|
|
enabled = function()
|
|
|
|
enabled = function()
|
|
|
|
return lsp.diagnostics_exist(lsp_severity.HINT)
|
|
|
|
return default.lsp.diagnostics_exist(default.lsp_severity.HINT)
|
|
|
|
end,
|
|
|
|
end,
|
|
|
|
hl = { fg = colors.grey_fg2 },
|
|
|
|
hl = { fg = default.colors.grey_fg2 },
|
|
|
|
icon = " ",
|
|
|
|
icon = " ",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
info = {
|
|
|
|
info = {
|
|
|
|
provider = "diagnostic_info",
|
|
|
|
provider = "diagnostic_info",
|
|
|
|
enabled = function()
|
|
|
|
enabled = function()
|
|
|
|
return lsp.diagnostics_exist(lsp_severity.INFO)
|
|
|
|
return default.lsp.diagnostics_exist(default.lsp_severity.INFO)
|
|
|
|
end,
|
|
|
|
end,
|
|
|
|
hl = { fg = colors.green },
|
|
|
|
hl = { fg = default.colors.green },
|
|
|
|
icon = " ",
|
|
|
|
icon = " ",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
local lsp_progress = {
|
|
|
|
default.lsp_progress = {
|
|
|
|
provider = function()
|
|
|
|
provider = function()
|
|
|
|
local Lsp = vim.lsp.util.get_progress_messages()[1]
|
|
|
|
local Lsp = vim.lsp.util.get_progress_messages()[1]
|
|
|
|
|
|
|
|
|
|
|
@ -228,13 +239,13 @@ local lsp_progress = {
|
|
|
|
|
|
|
|
|
|
|
|
return ""
|
|
|
|
return ""
|
|
|
|
end,
|
|
|
|
end,
|
|
|
|
enabled = shortline or function(winid)
|
|
|
|
enabled = default.shortline or function(winid)
|
|
|
|
return vim.api.nvim_win_get_width(tonumber(winid) or 0) > 80
|
|
|
|
return vim.api.nvim_win_get_width(tonumber(winid) or 0) > 80
|
|
|
|
end,
|
|
|
|
end,
|
|
|
|
hl = { fg = colors.green },
|
|
|
|
hl = { fg = default.colors.green },
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
local lsp_icon = {
|
|
|
|
default.lsp_icon = {
|
|
|
|
provider = function()
|
|
|
|
provider = function()
|
|
|
|
if next(vim.lsp.buf_get_clients()) ~= nil then
|
|
|
|
if next(vim.lsp.buf_get_clients()) ~= nil then
|
|
|
|
return " LSP"
|
|
|
|
return " LSP"
|
|
|
@ -242,112 +253,112 @@ local lsp_icon = {
|
|
|
|
return ""
|
|
|
|
return ""
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end,
|
|
|
|
end,
|
|
|
|
enabled = shortline or function(winid)
|
|
|
|
enabled = default.shortline or function(winid)
|
|
|
|
return vim.api.nvim_win_get_width(tonumber(winid) or 0) > 70
|
|
|
|
return vim.api.nvim_win_get_width(tonumber(winid) or 0) > 70
|
|
|
|
end,
|
|
|
|
end,
|
|
|
|
hl = { fg = colors.grey_fg2, bg = colors.statusline_bg },
|
|
|
|
hl = { fg = default.colors.grey_fg2, bg = default.colors.statusline_bg },
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
local mode_colors = {
|
|
|
|
default.mode_colors = {
|
|
|
|
["n"] = { "NORMAL", colors.red },
|
|
|
|
["n"] = { "NORMAL", default.colors.red },
|
|
|
|
["no"] = { "N-PENDING", colors.red },
|
|
|
|
["no"] = { "N-PENDING", default.colors.red },
|
|
|
|
["i"] = { "INSERT", colors.dark_purple },
|
|
|
|
["i"] = { "INSERT", default.colors.dark_purple },
|
|
|
|
["ic"] = { "INSERT", colors.dark_purple },
|
|
|
|
["ic"] = { "INSERT", default.colors.dark_purple },
|
|
|
|
["t"] = { "TERMINAL", colors.green },
|
|
|
|
["t"] = { "TERMINAL", default.colors.green },
|
|
|
|
["v"] = { "VISUAL", colors.cyan },
|
|
|
|
["v"] = { "VISUAL", default.colors.cyan },
|
|
|
|
["V"] = { "V-LINE", colors.cyan },
|
|
|
|
["V"] = { "V-LINE", default.colors.cyan },
|
|
|
|
[""] = { "V-BLOCK", colors.cyan },
|
|
|
|
[""] = { "V-BLOCK", default.colors.cyan },
|
|
|
|
["R"] = { "REPLACE", colors.orange },
|
|
|
|
["R"] = { "REPLACE", default.colors.orange },
|
|
|
|
["Rv"] = { "V-REPLACE", colors.orange },
|
|
|
|
["Rv"] = { "V-REPLACE", default.colors.orange },
|
|
|
|
["s"] = { "SELECT", colors.nord_blue },
|
|
|
|
["s"] = { "SELECT", default.colors.nord_blue },
|
|
|
|
["S"] = { "S-LINE", colors.nord_blue },
|
|
|
|
["S"] = { "S-LINE", default.colors.nord_blue },
|
|
|
|
[""] = { "S-BLOCK", colors.nord_blue },
|
|
|
|
[""] = { "S-BLOCK", default.colors.nord_blue },
|
|
|
|
["c"] = { "COMMAND", colors.pink },
|
|
|
|
["c"] = { "COMMAND", default.colors.pink },
|
|
|
|
["cv"] = { "COMMAND", colors.pink },
|
|
|
|
["cv"] = { "COMMAND", default.colors.pink },
|
|
|
|
["ce"] = { "COMMAND", colors.pink },
|
|
|
|
["ce"] = { "COMMAND", default.colors.pink },
|
|
|
|
["r"] = { "PROMPT", colors.teal },
|
|
|
|
["r"] = { "PROMPT", default.colors.teal },
|
|
|
|
["rm"] = { "MORE", colors.teal },
|
|
|
|
["rm"] = { "MORE", default.colors.teal },
|
|
|
|
["r?"] = { "CONFIRM", colors.teal },
|
|
|
|
["r?"] = { "CONFIRM", default.colors.teal },
|
|
|
|
["!"] = { "SHELL", colors.green },
|
|
|
|
["!"] = { "SHELL", default.colors.green },
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
local chad_mode_hl = function()
|
|
|
|
default.chad_mode_hl = function()
|
|
|
|
return {
|
|
|
|
return {
|
|
|
|
fg = mode_colors[vim.fn.mode()][2],
|
|
|
|
fg = default.mode_colors[vim.fn.mode()][2],
|
|
|
|
bg = colors.one_bg,
|
|
|
|
bg = default.colors.one_bg,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
local empty_space = {
|
|
|
|
default.empty_space = {
|
|
|
|
provider = " " .. statusline_style.left,
|
|
|
|
provider = " " .. default.statusline_style.left,
|
|
|
|
hl = {
|
|
|
|
hl = {
|
|
|
|
fg = colors.one_bg2,
|
|
|
|
fg = default.colors.one_bg2,
|
|
|
|
bg = colors.statusline_bg,
|
|
|
|
bg = default.colors.statusline_bg,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
-- this matches the vi mode color
|
|
|
|
-- this matches the vi mode color
|
|
|
|
local empty_spaceColored = {
|
|
|
|
default.empty_spaceColored = {
|
|
|
|
provider = statusline_style.left,
|
|
|
|
provider = default.statusline_style.left,
|
|
|
|
hl = function()
|
|
|
|
hl = function()
|
|
|
|
return {
|
|
|
|
return {
|
|
|
|
fg = mode_colors[vim.fn.mode()][2],
|
|
|
|
fg = default.mode_colors[vim.fn.mode()][2],
|
|
|
|
bg = colors.one_bg2,
|
|
|
|
bg = default.colors.one_bg2,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
end,
|
|
|
|
end,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
local mode_icon = {
|
|
|
|
default.mode_icon = {
|
|
|
|
provider = statusline_style.vi_mode_icon,
|
|
|
|
provider = default.statusline_style.vi_mode_icon,
|
|
|
|
hl = function()
|
|
|
|
hl = function()
|
|
|
|
return {
|
|
|
|
return {
|
|
|
|
fg = colors.statusline_bg,
|
|
|
|
fg = default.colors.statusline_bg,
|
|
|
|
bg = mode_colors[vim.fn.mode()][2],
|
|
|
|
bg = default.mode_colors[vim.fn.mode()][2],
|
|
|
|
}
|
|
|
|
}
|
|
|
|
end,
|
|
|
|
end,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
local empty_space2 = {
|
|
|
|
default.empty_space2 = {
|
|
|
|
provider = function()
|
|
|
|
provider = function()
|
|
|
|
return " " .. mode_colors[vim.fn.mode()][1] .. " "
|
|
|
|
return " " .. default.mode_colors[vim.fn.mode()][1] .. " "
|
|
|
|
end,
|
|
|
|
end,
|
|
|
|
hl = chad_mode_hl,
|
|
|
|
hl = default.chad_mode_hl,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
local separator_right = {
|
|
|
|
default.separator_right = {
|
|
|
|
provider = statusline_style.left,
|
|
|
|
provider = default.statusline_style.left,
|
|
|
|
enabled = shortline or function(winid)
|
|
|
|
enabled = default.shortline or function(winid)
|
|
|
|
return vim.api.nvim_win_get_width(tonumber(winid) or 0) > 90
|
|
|
|
return vim.api.nvim_win_get_width(tonumber(winid) or 0) > 90
|
|
|
|
end,
|
|
|
|
end,
|
|
|
|
hl = {
|
|
|
|
hl = {
|
|
|
|
fg = colors.grey,
|
|
|
|
fg = default.colors.grey,
|
|
|
|
bg = colors.one_bg,
|
|
|
|
bg = default.colors.one_bg,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
local separator_right2 = {
|
|
|
|
default.separator_right2 = {
|
|
|
|
provider = statusline_style.left,
|
|
|
|
provider = default.statusline_style.left,
|
|
|
|
enabled = shortline or function(winid)
|
|
|
|
enabled = default.shortline or function(winid)
|
|
|
|
return vim.api.nvim_win_get_width(tonumber(winid) or 0) > 90
|
|
|
|
return vim.api.nvim_win_get_width(tonumber(winid) or 0) > 90
|
|
|
|
end,
|
|
|
|
end,
|
|
|
|
hl = {
|
|
|
|
hl = {
|
|
|
|
fg = colors.green,
|
|
|
|
fg = default.colors.green,
|
|
|
|
bg = colors.grey,
|
|
|
|
bg = default.colors.grey,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
local position_icon = {
|
|
|
|
default.position_icon = {
|
|
|
|
provider = statusline_style.position_icon,
|
|
|
|
provider = default.statusline_style.position_icon,
|
|
|
|
enabled = shortline or function(winid)
|
|
|
|
enabled = default.shortline or function(winid)
|
|
|
|
return vim.api.nvim_win_get_width(tonumber(winid) or 0) > 90
|
|
|
|
return vim.api.nvim_win_get_width(tonumber(winid) or 0) > 90
|
|
|
|
end,
|
|
|
|
end,
|
|
|
|
hl = {
|
|
|
|
hl = {
|
|
|
|
fg = colors.black,
|
|
|
|
fg = default.colors.black,
|
|
|
|
bg = colors.green,
|
|
|
|
bg = default.colors.green,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
local current_line = {
|
|
|
|
default.current_line = {
|
|
|
|
provider = function()
|
|
|
|
provider = function()
|
|
|
|
local current_line = vim.fn.line "."
|
|
|
|
local current_line = vim.fn.line "."
|
|
|
|
local total_line = vim.fn.line "$"
|
|
|
|
local total_line = vim.fn.line "$"
|
|
|
@ -361,13 +372,13 @@ local current_line = {
|
|
|
|
return " " .. result .. "%% "
|
|
|
|
return " " .. result .. "%% "
|
|
|
|
end,
|
|
|
|
end,
|
|
|
|
|
|
|
|
|
|
|
|
enabled = shortline or function(winid)
|
|
|
|
enabled = default.shortline or function(winid)
|
|
|
|
return vim.api.nvim_win_get_width(tonumber(winid) or 0) > 90
|
|
|
|
return vim.api.nvim_win_get_width(tonumber(winid) or 0) > 90
|
|
|
|
end,
|
|
|
|
end,
|
|
|
|
|
|
|
|
|
|
|
|
hl = {
|
|
|
|
hl = {
|
|
|
|
fg = colors.green,
|
|
|
|
fg = default.colors.green,
|
|
|
|
bg = colors.one_bg,
|
|
|
|
bg = default.colors.one_bg,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -375,45 +386,53 @@ local function add_table(a, b)
|
|
|
|
table.insert(a, b)
|
|
|
|
table.insert(a, b)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
-- components are divided in 3 sections
|
|
|
|
local M = {}
|
|
|
|
local left = {}
|
|
|
|
M.setup = function(override_flag)
|
|
|
|
local middle = {}
|
|
|
|
if override_flag then
|
|
|
|
local right = {}
|
|
|
|
default = require("core.utils").tbl_override_req("feline", default)
|
|
|
|
|
|
|
|
end
|
|
|
|
-- left
|
|
|
|
-- components are divided in 3 sections
|
|
|
|
add_table(left, main_icon)
|
|
|
|
default.left = {}
|
|
|
|
add_table(left, file_name)
|
|
|
|
default.middle = {}
|
|
|
|
add_table(left, dir_name)
|
|
|
|
default.right = {}
|
|
|
|
add_table(left, diff.add)
|
|
|
|
|
|
|
|
add_table(left, diff.change)
|
|
|
|
-- left
|
|
|
|
add_table(left, diff.remove)
|
|
|
|
add_table(default.left, default.main_icon)
|
|
|
|
add_table(left, diagnostic.error)
|
|
|
|
add_table(default.left, default.file_name)
|
|
|
|
add_table(left, diagnostic.warning)
|
|
|
|
add_table(default.left, default.dir_name)
|
|
|
|
add_table(left, diagnostic.hint)
|
|
|
|
add_table(default.left, default.diff.add)
|
|
|
|
add_table(left, diagnostic.info)
|
|
|
|
add_table(default.left, default.diff.change)
|
|
|
|
|
|
|
|
add_table(default.left, default.diff.remove)
|
|
|
|
add_table(middle, lsp_progress)
|
|
|
|
add_table(default.left, default.diagnostic.error)
|
|
|
|
|
|
|
|
add_table(default.left, default.diagnostic.warning)
|
|
|
|
-- right
|
|
|
|
add_table(default.left, default.diagnostic.hint)
|
|
|
|
add_table(right, lsp_icon)
|
|
|
|
add_table(default.left, default.diagnostic.info)
|
|
|
|
add_table(right, git_branch)
|
|
|
|
|
|
|
|
add_table(right, empty_space)
|
|
|
|
add_table(default.middle, default.lsp_progress)
|
|
|
|
add_table(right, empty_spaceColored)
|
|
|
|
|
|
|
|
add_table(right, mode_icon)
|
|
|
|
-- right
|
|
|
|
add_table(right, empty_space2)
|
|
|
|
add_table(default.right, default.lsp_icon)
|
|
|
|
add_table(right, separator_right)
|
|
|
|
add_table(default.right, default.git_branch)
|
|
|
|
add_table(right, separator_right2)
|
|
|
|
add_table(default.right, default.empty_space)
|
|
|
|
add_table(right, position_icon)
|
|
|
|
add_table(default.right, default.empty_spaceColored)
|
|
|
|
add_table(right, current_line)
|
|
|
|
add_table(default.right, default.mode_icon)
|
|
|
|
|
|
|
|
add_table(default.right, default.empty_space2)
|
|
|
|
components.active[1] = left
|
|
|
|
add_table(default.right, default.separator_right)
|
|
|
|
components.active[2] = middle
|
|
|
|
add_table(default.right, default.separator_right2)
|
|
|
|
components.active[3] = right
|
|
|
|
add_table(default.right, default.position_icon)
|
|
|
|
|
|
|
|
add_table(default.right, default.current_line)
|
|
|
|
require("feline").setup {
|
|
|
|
|
|
|
|
theme = {
|
|
|
|
default.components.active[1] = default.left
|
|
|
|
bg = colors.statusline_bg,
|
|
|
|
default.components.active[2] = default.middle
|
|
|
|
fg = colors.fg,
|
|
|
|
default.components.active[3] = default.right
|
|
|
|
},
|
|
|
|
|
|
|
|
components = components,
|
|
|
|
feline.setup {
|
|
|
|
}
|
|
|
|
theme = {
|
|
|
|
|
|
|
|
bg = default.colors.statusline_bg,
|
|
|
|
|
|
|
|
fg = default.colors.fg,
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
components = default.components,
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return M
|
|
|
|