2021-03-12 20:23:02 -05:00
|
|
|
|
local gl = require("galaxyline")
|
2021-03-07 09:22:30 -05:00
|
|
|
|
local gls = gl.section
|
2021-06-06 01:35:53 -04:00
|
|
|
|
local condition = require("galaxyline.condition")
|
2021-04-02 01:36:20 -04:00
|
|
|
|
|
2021-06-01 21:39:16 -04:00
|
|
|
|
gl.short_line_list = {" "}
|
2021-03-07 09:22:30 -05:00
|
|
|
|
|
2021-06-13 22:27:56 -04:00
|
|
|
|
local colors = require "themes/onedark"
|
|
|
|
|
|
|
|
|
|
gls.left[1] = {
|
|
|
|
|
FirstElement = {
|
|
|
|
|
provider = function() return '▋' end,
|
|
|
|
|
highlight = { colors.nord_blue, colors.nord_blue }
|
|
|
|
|
},
|
2021-03-08 00:24:53 -05:00
|
|
|
|
}
|
|
|
|
|
|
2021-03-07 09:22:30 -05:00
|
|
|
|
gls.left[2] = {
|
2021-04-02 01:36:20 -04:00
|
|
|
|
statusIcon = {
|
2021-03-12 20:23:02 -05:00
|
|
|
|
provider = function()
|
2021-06-13 22:27:56 -04:00
|
|
|
|
return " "
|
2021-03-12 20:23:02 -05:00
|
|
|
|
end,
|
2021-06-13 22:27:56 -04:00
|
|
|
|
highlight = {colors.statusline_bg, colors.nord_blue},
|
2021-05-24 22:31:14 -04:00
|
|
|
|
separator = " ",
|
2021-06-13 22:27:56 -04:00
|
|
|
|
separator_highlight = {colors.nord_blue, colors.lightbg}
|
2021-03-12 20:23:02 -05:00
|
|
|
|
}
|
2021-03-07 09:22:30 -05:00
|
|
|
|
}
|
|
|
|
|
|
2021-03-12 20:23:02 -05:00
|
|
|
|
gls.left[3] = {
|
|
|
|
|
FileIcon = {
|
|
|
|
|
provider = "FileIcon",
|
2021-06-06 01:35:53 -04:00
|
|
|
|
condition = condition.buffer_not_empty,
|
2021-06-13 22:27:56 -04:00
|
|
|
|
highlight = {colors.white, colors.lightbg}
|
2021-03-12 20:23:02 -05:00
|
|
|
|
}
|
2021-03-07 09:22:30 -05:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
gls.left[4] = {
|
2021-03-12 20:23:02 -05:00
|
|
|
|
FileName = {
|
2021-05-24 22:31:14 -04:00
|
|
|
|
provider = {"FileName"},
|
2021-06-06 01:35:53 -04:00
|
|
|
|
condition = condition.buffer_not_empty,
|
2021-06-13 22:27:56 -04:00
|
|
|
|
highlight = {colors.white, colors.lightbg},
|
2021-05-24 22:31:14 -04:00
|
|
|
|
separator = " ",
|
2021-06-01 14:47:46 -04:00
|
|
|
|
separator_highlight = {colors.lightbg, colors.lightbg2}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
gls.left[5] = {
|
|
|
|
|
current_dir = {
|
|
|
|
|
provider = function()
|
|
|
|
|
local dir_name = vim.fn.fnamemodify(vim.fn.getcwd(), ":t")
|
|
|
|
|
return " " .. dir_name .. " "
|
|
|
|
|
end,
|
2021-06-13 22:27:56 -04:00
|
|
|
|
highlight = {colors.grey_fg2, colors.lightbg2},
|
2021-06-01 14:47:46 -04:00
|
|
|
|
separator = " ",
|
2021-06-13 22:27:56 -04:00
|
|
|
|
separator_highlight = {colors.lightbg2, colors.statusline_bg}
|
2021-03-12 20:23:02 -05:00
|
|
|
|
}
|
2021-03-08 00:24:53 -05:00
|
|
|
|
}
|
|
|
|
|
|
2021-03-07 09:22:30 -05:00
|
|
|
|
local checkwidth = function()
|
2021-03-12 20:23:02 -05:00
|
|
|
|
local squeeze_width = vim.fn.winwidth(0) / 2
|
2021-05-24 22:31:14 -04:00
|
|
|
|
if squeeze_width > 30 then
|
2021-03-12 20:23:02 -05:00
|
|
|
|
return true
|
|
|
|
|
end
|
|
|
|
|
return false
|
2021-03-07 09:22:30 -05:00
|
|
|
|
end
|
|
|
|
|
|
2021-06-01 14:47:46 -04:00
|
|
|
|
gls.left[6] = {
|
2021-03-12 20:23:02 -05:00
|
|
|
|
DiffAdd = {
|
|
|
|
|
provider = "DiffAdd",
|
|
|
|
|
condition = checkwidth,
|
2021-05-24 22:31:14 -04:00
|
|
|
|
icon = " ",
|
2021-06-13 22:27:56 -04:00
|
|
|
|
highlight = {colors.white, colors.statusline_bg}
|
2021-03-12 20:23:02 -05:00
|
|
|
|
}
|
2021-03-07 09:22:30 -05:00
|
|
|
|
}
|
|
|
|
|
|
2021-06-01 14:47:46 -04:00
|
|
|
|
gls.left[7] = {
|
2021-03-12 20:23:02 -05:00
|
|
|
|
DiffModified = {
|
|
|
|
|
provider = "DiffModified",
|
|
|
|
|
condition = checkwidth,
|
2021-05-24 22:31:14 -04:00
|
|
|
|
icon = " ",
|
2021-06-13 22:27:56 -04:00
|
|
|
|
highlight = {colors.grey_fg2, colors.statusline_bg}
|
2021-03-12 20:23:02 -05:00
|
|
|
|
}
|
2021-03-07 09:22:30 -05:00
|
|
|
|
}
|
|
|
|
|
|
2021-06-01 14:47:46 -04:00
|
|
|
|
gls.left[8] = {
|
2021-03-12 20:23:02 -05:00
|
|
|
|
DiffRemove = {
|
|
|
|
|
provider = "DiffRemove",
|
|
|
|
|
condition = checkwidth,
|
2021-05-24 22:31:14 -04:00
|
|
|
|
icon = " ",
|
2021-06-13 22:27:56 -04:00
|
|
|
|
highlight = {colors.grey_fg2, colors.statusline_bg}
|
2021-03-12 20:23:02 -05:00
|
|
|
|
}
|
2021-03-07 09:22:30 -05:00
|
|
|
|
}
|
|
|
|
|
|
2021-06-01 14:47:46 -04:00
|
|
|
|
gls.left[9] = {
|
2021-03-12 20:23:02 -05:00
|
|
|
|
DiagnosticError = {
|
|
|
|
|
provider = "DiagnosticError",
|
|
|
|
|
icon = " ",
|
2021-06-13 22:27:56 -04:00
|
|
|
|
highlight = {colors.red, colors.statusline_bg}
|
2021-03-12 20:23:02 -05:00
|
|
|
|
}
|
2021-03-07 09:22:30 -05:00
|
|
|
|
}
|
|
|
|
|
|
2021-06-01 14:47:46 -04:00
|
|
|
|
gls.left[10] = {
|
2021-03-12 20:23:02 -05:00
|
|
|
|
DiagnosticWarn = {
|
|
|
|
|
provider = "DiagnosticWarn",
|
|
|
|
|
icon = " ",
|
2021-06-13 22:27:56 -04:00
|
|
|
|
highlight = {colors.yellow, colors.statusline_bg}
|
2021-03-12 20:23:02 -05:00
|
|
|
|
}
|
2021-03-07 09:22:30 -05:00
|
|
|
|
}
|
|
|
|
|
|
2021-03-08 00:24:53 -05:00
|
|
|
|
gls.right[1] = {
|
2021-06-06 01:35:53 -04:00
|
|
|
|
lsp_status = {
|
2021-06-13 22:27:56 -04:00
|
|
|
|
provider = function()
|
2021-06-06 01:35:53 -04:00
|
|
|
|
local clients = vim.lsp.get_active_clients()
|
|
|
|
|
if next(clients) ~= nil then
|
2021-06-13 22:27:56 -04:00
|
|
|
|
return " " .. " " .. " LSP "
|
2021-06-06 01:35:53 -04:00
|
|
|
|
else
|
|
|
|
|
return ""
|
|
|
|
|
end
|
|
|
|
|
end,
|
2021-06-13 22:27:56 -04:00
|
|
|
|
highlight = {colors.grey_fg2, colors.statusline_bg}
|
2021-06-06 01:35:53 -04:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
gls.right[2] = {
|
2021-03-12 20:23:02 -05:00
|
|
|
|
GitIcon = {
|
|
|
|
|
provider = function()
|
2021-05-24 22:31:14 -04:00
|
|
|
|
return " "
|
2021-03-12 20:23:02 -05:00
|
|
|
|
end,
|
|
|
|
|
condition = require("galaxyline.provider_vcs").check_git_workspace,
|
2021-06-13 22:27:56 -04:00
|
|
|
|
highlight = {colors.grey_fg2, colors.lightbg},
|
2021-05-24 22:31:14 -04:00
|
|
|
|
separator = "",
|
2021-06-13 22:27:56 -04:00
|
|
|
|
separator_highlight = {colors.lightbg, colors.statusline_bg}
|
2021-03-12 20:23:02 -05:00
|
|
|
|
}
|
2021-03-08 02:34:48 -05:00
|
|
|
|
}
|
|
|
|
|
|
2021-06-06 01:35:53 -04:00
|
|
|
|
gls.right[3] = {
|
2021-03-12 20:23:02 -05:00
|
|
|
|
GitBranch = {
|
|
|
|
|
provider = "GitBranch",
|
|
|
|
|
condition = require("galaxyline.provider_vcs").check_git_workspace,
|
2021-06-13 22:27:56 -04:00
|
|
|
|
highlight = {colors.grey_fg2, colors.lightbg}
|
2021-03-12 20:23:02 -05:00
|
|
|
|
}
|
2021-03-08 02:34:48 -05:00
|
|
|
|
}
|
|
|
|
|
|
2021-06-06 01:35:53 -04:00
|
|
|
|
gls.right[4] = {
|
2021-05-24 22:31:14 -04:00
|
|
|
|
viMode_icon = {
|
2021-03-12 20:23:02 -05:00
|
|
|
|
provider = function()
|
2021-05-24 22:31:14 -04:00
|
|
|
|
return " "
|
2021-03-12 20:23:02 -05:00
|
|
|
|
end,
|
2021-06-13 22:27:56 -04:00
|
|
|
|
highlight = {colors.statusline_bg, colors.red},
|
2021-05-24 22:31:14 -04:00
|
|
|
|
separator = " ",
|
|
|
|
|
separator_highlight = {colors.red, colors.lightbg}
|
2021-03-12 20:23:02 -05:00
|
|
|
|
}
|
2021-03-08 00:24:53 -05:00
|
|
|
|
}
|
|
|
|
|
|
2021-06-06 01:35:53 -04:00
|
|
|
|
gls.right[5] = {
|
2021-04-02 01:36:20 -04:00
|
|
|
|
ViMode = {
|
2021-03-12 20:23:02 -05:00
|
|
|
|
provider = function()
|
|
|
|
|
local alias = {
|
2021-05-24 22:31:14 -04:00
|
|
|
|
n = "Normal",
|
|
|
|
|
i = "Insert",
|
|
|
|
|
c = "Command",
|
|
|
|
|
V = "Visual",
|
|
|
|
|
[""] = "Visual",
|
|
|
|
|
v = "Visual",
|
|
|
|
|
R = "Replace"
|
2021-03-12 20:23:02 -05:00
|
|
|
|
}
|
2021-05-24 22:54:22 -04:00
|
|
|
|
local current_Mode = alias[vim.fn.mode()]
|
|
|
|
|
|
2021-05-25 07:37:37 -04:00
|
|
|
|
if current_Mode == nil then
|
|
|
|
|
return " Terminal "
|
|
|
|
|
else
|
2021-05-24 22:54:22 -04:00
|
|
|
|
return " " .. current_Mode .. " "
|
|
|
|
|
end
|
2021-03-12 20:23:02 -05:00
|
|
|
|
end,
|
2021-05-24 22:31:14 -04:00
|
|
|
|
highlight = {colors.red, colors.lightbg}
|
2021-03-12 20:23:02 -05:00
|
|
|
|
}
|
2021-03-07 09:22:30 -05:00
|
|
|
|
}
|
|
|
|
|
|
2021-06-06 01:35:53 -04:00
|
|
|
|
gls.right[6] = {
|
|
|
|
|
some_icon = {
|
2021-05-24 22:31:14 -04:00
|
|
|
|
provider = function()
|
2021-06-06 01:35:53 -04:00
|
|
|
|
return " "
|
2021-05-24 22:31:14 -04:00
|
|
|
|
end,
|
|
|
|
|
separator = "",
|
2021-06-01 14:47:46 -04:00
|
|
|
|
separator_highlight = {colors.green, colors.lightbg},
|
2021-05-24 22:31:14 -04:00
|
|
|
|
highlight = {colors.lightbg, colors.green}
|
2021-03-12 20:23:02 -05:00
|
|
|
|
}
|
2021-03-07 09:22:30 -05:00
|
|
|
|
}
|
2021-03-08 01:19:27 -05:00
|
|
|
|
|
2021-06-06 01:35:53 -04:00
|
|
|
|
gls.right[7] = {
|
|
|
|
|
line_percentage = {
|
2021-03-12 20:23:02 -05:00
|
|
|
|
provider = function()
|
2021-06-06 01:35:53 -04:00
|
|
|
|
local current_line = vim.fn.line(".")
|
|
|
|
|
local total_line = vim.fn.line("$")
|
|
|
|
|
|
|
|
|
|
if current_line == 1 then
|
|
|
|
|
return " Top "
|
|
|
|
|
elseif current_line == vim.fn.line("$") then
|
|
|
|
|
return " Bot "
|
|
|
|
|
end
|
|
|
|
|
local result, _ = math.modf((current_line / total_line) * 100)
|
|
|
|
|
return " " .. result .. "% "
|
2021-03-12 20:23:02 -05:00
|
|
|
|
end,
|
2021-05-24 22:31:14 -04:00
|
|
|
|
highlight = {colors.green, colors.lightbg}
|
2021-03-12 20:23:02 -05:00
|
|
|
|
}
|
2021-03-08 01:19:27 -05:00
|
|
|
|
}
|