my-nvim-setup/lua/statusline.lua

169 lines
3.7 KiB
Lua
Raw Normal View History

2021-03-13 01:23:02 +00:00
local gl = require("galaxyline")
2021-03-07 14:22:30 +00:00
local gls = gl.section
2021-04-02 06:36:20 +01:00
2021-05-25 03:49:58 +01:00
gl.short_line_list = {" "} -- keeping this table { } as empty will show inactive statuslines
2021-03-07 14:22:30 +00:00
local colors = {
2021-05-25 03:31:14 +01:00
bg = "#22262e",
fg = "#abb2bf",
green = "#82ad63",
red = "#d47d85",
lightbg = "#2e323a",
blue = "#7797b7",
yellow = "#e0c080",
grey = "#6f737b"
2021-03-08 05:24:53 +00:00
}
2021-03-07 14:22:30 +00:00
gls.left[2] = {
2021-04-02 06:36:20 +01:00
statusIcon = {
2021-03-13 01:23:02 +00:00
provider = function()
2021-05-25 03:31:14 +01:00
return ""
2021-03-13 01:23:02 +00:00
end,
2021-05-25 03:31:14 +01:00
highlight = {colors.bg, colors.blue},
separator = "",
separator_highlight = {colors.blue, colors.lightbg}
2021-03-13 01:23:02 +00:00
}
2021-03-07 14:22:30 +00:00
}
2021-03-13 01:23:02 +00:00
gls.left[3] = {
FileIcon = {
provider = "FileIcon",
condition = buffer_not_empty,
2021-05-25 03:31:14 +01:00
highlight = {colors.fg, colors.lightbg}
2021-03-13 01:23:02 +00:00
}
2021-03-07 14:22:30 +00:00
}
gls.left[4] = {
2021-03-13 01:23:02 +00:00
FileName = {
2021-05-25 03:31:14 +01:00
provider = {"FileName"},
2021-03-13 01:23:02 +00:00
condition = buffer_not_empty,
2021-05-25 03:31:14 +01:00
highlight = {colors.fg, colors.lightbg},
separator = "",
separator_highlight = {colors.lightbg, colors.bg}
2021-03-13 01:23:02 +00:00
}
2021-03-08 05:24:53 +00:00
}
2021-03-07 14:22:30 +00:00
local checkwidth = function()
2021-03-13 01:23:02 +00:00
local squeeze_width = vim.fn.winwidth(0) / 2
2021-05-25 03:31:14 +01:00
if squeeze_width > 30 then
2021-03-13 01:23:02 +00:00
return true
end
return false
2021-03-07 14:22:30 +00:00
end
2021-05-25 03:31:14 +01:00
gls.left[5] = {
2021-03-13 01:23:02 +00:00
DiffAdd = {
provider = "DiffAdd",
condition = checkwidth,
2021-05-25 03:31:14 +01:00
icon = "",
highlight = {colors.fg, colors.bg}
2021-03-13 01:23:02 +00:00
}
2021-03-07 14:22:30 +00:00
}
2021-05-25 03:31:14 +01:00
gls.left[6] = {
2021-03-13 01:23:02 +00:00
DiffModified = {
provider = "DiffModified",
condition = checkwidth,
2021-05-25 03:31:14 +01:00
icon = "",
highlight = {colors.grey, colors.bg}
2021-03-13 01:23:02 +00:00
}
2021-03-07 14:22:30 +00:00
}
2021-05-25 03:31:14 +01:00
gls.left[7] = {
2021-03-13 01:23:02 +00:00
DiffRemove = {
provider = "DiffRemove",
condition = checkwidth,
2021-05-25 03:31:14 +01:00
icon = "",
highlight = {colors.grey, colors.bg}
2021-03-13 01:23:02 +00:00
}
2021-03-07 14:22:30 +00:00
}
2021-05-25 03:31:14 +01:00
gls.left[8] = {
2021-03-13 01:23:02 +00:00
DiagnosticError = {
provider = "DiagnosticError",
icon = "",
2021-05-25 03:31:14 +01:00
highlight = {colors.grey, colors.bg}
2021-03-13 01:23:02 +00:00
}
2021-03-07 14:22:30 +00:00
}
2021-05-25 03:31:14 +01:00
gls.left[9] = {
2021-03-13 01:23:02 +00:00
DiagnosticWarn = {
provider = "DiagnosticWarn",
icon = "",
2021-05-25 03:31:14 +01:00
highlight = {colors.yellow, colors.bg}
2021-03-13 01:23:02 +00:00
}
2021-03-07 14:22:30 +00:00
}
2021-03-08 05:24:53 +00:00
gls.right[1] = {
2021-03-13 01:23:02 +00:00
GitIcon = {
provider = function()
2021-05-25 03:31:14 +01:00
return ""
2021-03-13 01:23:02 +00:00
end,
condition = require("galaxyline.provider_vcs").check_git_workspace,
2021-05-25 03:31:14 +01:00
highlight = {colors.grey, colors.lightbg},
separator = "",
separator_highlight = {colors.lightbg, colors.bg}
2021-03-13 01:23:02 +00:00
}
2021-03-08 07:34:48 +00:00
}
gls.right[2] = {
2021-03-13 01:23:02 +00:00
GitBranch = {
provider = "GitBranch",
condition = require("galaxyline.provider_vcs").check_git_workspace,
2021-05-25 03:31:14 +01:00
highlight = {colors.grey, colors.lightbg}
2021-03-13 01:23:02 +00:00
}
2021-03-08 07:34:48 +00:00
}
gls.right[3] = {
2021-05-25 03:31:14 +01:00
viMode_icon = {
2021-03-13 01:23:02 +00:00
provider = function()
2021-05-25 03:31:14 +01:00
return ""
2021-03-13 01:23:02 +00:00
end,
2021-05-25 03:31:14 +01:00
highlight = {colors.bg, colors.red},
separator = "",
separator_highlight = {colors.red, colors.lightbg}
2021-03-13 01:23:02 +00:00
}
2021-03-08 05:24:53 +00:00
}
2021-03-08 07:34:48 +00:00
gls.right[4] = {
2021-04-02 06:36:20 +01:00
ViMode = {
2021-03-13 01:23:02 +00:00
provider = function()
local alias = {
2021-05-25 03:31:14 +01:00
n = "Normal",
i = "Insert",
c = "Command",
V = "Visual",
[""] = "Visual",
v = "Visual",
R = "Replace"
2021-03-13 01:23:02 +00:00
}
2021-05-25 03:54:22 +01:00
local current_Mode = alias[vim.fn.mode()]
if current_Mode ~= nil then
return " " .. current_Mode .. " "
end
2021-03-13 01:23:02 +00:00
end,
2021-05-25 03:31:14 +01:00
highlight = {colors.red, colors.lightbg}
2021-03-13 01:23:02 +00:00
}
2021-03-07 14:22:30 +00:00
}
2021-03-08 07:34:48 +00:00
gls.right[5] = {
2021-05-25 03:31:14 +01:00
time_icon = {
provider = function()
return ""
end,
separator = "",
separator_highlight = {colors.green, colors.bg},
highlight = {colors.lightbg, colors.green}
2021-03-13 01:23:02 +00:00
}
2021-03-07 14:22:30 +00:00
}
2021-03-08 06:19:27 +00:00
2021-03-08 07:34:48 +00:00
gls.right[6] = {
2021-05-25 03:31:14 +01:00
time = {
2021-03-13 01:23:02 +00:00
provider = function()
2021-05-25 03:31:14 +01:00
return " " .. os.date("%H:%M") .. " "
2021-03-13 01:23:02 +00:00
end,
2021-05-25 03:31:14 +01:00
highlight = {colors.green, colors.lightbg}
2021-03-13 01:23:02 +00:00
}
2021-03-08 06:19:27 +00:00
}