2021-04-24 01:57:41 +02:00
|
|
|
|
-- BASED OFF https://github.com/LoydAndrew/nvim/blob/main/evilline.lua
|
|
|
|
|
|
2021-11-05 17:44:11 +01:00
|
|
|
|
local gl = require "galaxyline"
|
2021-04-24 01:57:41 +02:00
|
|
|
|
local gls = gl.section
|
|
|
|
|
|
|
|
|
|
gl.short_line_list = {
|
2021-11-05 17:44:11 +01:00
|
|
|
|
"LuaTree",
|
|
|
|
|
"vista",
|
|
|
|
|
"dbui",
|
|
|
|
|
"startify",
|
|
|
|
|
"term",
|
|
|
|
|
"nerdtree",
|
|
|
|
|
"fugitive",
|
|
|
|
|
"fugitiveblame",
|
|
|
|
|
"plug",
|
2021-04-24 01:57:41 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
-- VistaPlugin = extension.vista_nearest
|
|
|
|
|
|
|
|
|
|
local colors = {
|
2021-11-05 17:44:11 +01:00
|
|
|
|
bg = "#44475a",
|
|
|
|
|
line_bg = "#282c34",
|
|
|
|
|
fg = "#f8f8f2",
|
|
|
|
|
fg_green = "#65a380",
|
|
|
|
|
yellow = "#f1fa8c",
|
|
|
|
|
cyan = "#8be9fd",
|
|
|
|
|
darkblue = "#081633",
|
|
|
|
|
green = "#50fa7b",
|
|
|
|
|
orange = "#ffb86c",
|
|
|
|
|
purple = "#bd93f9",
|
|
|
|
|
magenta = "#ff79c6",
|
|
|
|
|
blue = "#51afef",
|
|
|
|
|
red = "#ff5555",
|
2021-04-24 01:57:41 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
local mode_color = {
|
2021-11-05 17:44:11 +01:00
|
|
|
|
n = colors.green,
|
|
|
|
|
i = colors.blue,
|
|
|
|
|
v = colors.magenta,
|
|
|
|
|
[""] = colors.blue,
|
|
|
|
|
V = colors.blue,
|
|
|
|
|
no = colors.magenta,
|
|
|
|
|
s = colors.orange,
|
|
|
|
|
S = colors.orange,
|
|
|
|
|
[""] = colors.orange,
|
|
|
|
|
ic = colors.yellow,
|
|
|
|
|
cv = colors.red,
|
|
|
|
|
ce = colors.red,
|
|
|
|
|
["!"] = colors.green,
|
|
|
|
|
t = colors.green,
|
|
|
|
|
c = colors.purple,
|
|
|
|
|
["r?"] = colors.red,
|
|
|
|
|
["r"] = colors.red,
|
|
|
|
|
rm = colors.red,
|
|
|
|
|
R = colors.yellow,
|
|
|
|
|
Rv = colors.magenta,
|
2021-04-24 01:57:41 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
local function trailing_whitespace()
|
2021-11-05 17:44:11 +01:00
|
|
|
|
local trail = vim.fn.search("\\s$", "nw")
|
|
|
|
|
if trail ~= 0 then
|
|
|
|
|
return " "
|
|
|
|
|
else
|
|
|
|
|
return nil
|
|
|
|
|
end
|
2021-04-24 01:57:41 +02:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
TrailingWhiteSpace = trailing_whitespace
|
|
|
|
|
|
2022-01-22 16:38:51 +01:00
|
|
|
|
local function has_file_type()
|
2021-11-05 17:44:11 +01:00
|
|
|
|
local f_type = vim.bo.filetype
|
|
|
|
|
if not f_type or f_type == "" then
|
|
|
|
|
return false
|
|
|
|
|
end
|
|
|
|
|
return true
|
2021-04-24 01:57:41 +02:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
local buffer_not_empty = function()
|
2021-11-05 17:44:11 +01:00
|
|
|
|
if vim.fn.empty(vim.fn.expand "%:t") ~= 1 then
|
|
|
|
|
return true
|
|
|
|
|
end
|
|
|
|
|
return false
|
2021-04-24 01:57:41 +02:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
gls.left[1] = {
|
2021-11-05 17:44:11 +01:00
|
|
|
|
FirstElement = {
|
|
|
|
|
provider = function()
|
|
|
|
|
return " "
|
|
|
|
|
end,
|
|
|
|
|
highlight = { colors.blue, colors.line_bg },
|
|
|
|
|
},
|
2021-04-24 01:57:41 +02:00
|
|
|
|
}
|
|
|
|
|
gls.left[2] = {
|
2021-11-05 17:44:11 +01:00
|
|
|
|
ViMode = {
|
|
|
|
|
provider = function()
|
|
|
|
|
-- auto change color according the vim mode
|
|
|
|
|
local alias = {
|
|
|
|
|
n = "NORMAL",
|
|
|
|
|
i = "INSERT",
|
|
|
|
|
V = "VISUAL",
|
|
|
|
|
[""] = "VISUAL",
|
|
|
|
|
v = "VISUAL",
|
|
|
|
|
c = "COMMAND-LINE",
|
|
|
|
|
["r?"] = ":CONFIRM",
|
|
|
|
|
rm = "--MORE",
|
|
|
|
|
R = "REPLACE",
|
|
|
|
|
Rv = "VIRTUAL",
|
|
|
|
|
s = "SELECT",
|
|
|
|
|
S = "SELECT",
|
|
|
|
|
["r"] = "HIT-ENTER",
|
|
|
|
|
[""] = "SELECT",
|
|
|
|
|
t = "TERMINAL",
|
|
|
|
|
["!"] = "SHELL",
|
|
|
|
|
}
|
|
|
|
|
local vim_mode = vim.fn.mode()
|
|
|
|
|
vim.api.nvim_command("hi GalaxyViMode guibg=" .. mode_color[vim_mode])
|
|
|
|
|
return alias[vim_mode] .. " "
|
|
|
|
|
end,
|
|
|
|
|
highlight = { colors.line_bg, colors.line_bg, "bold" },
|
|
|
|
|
},
|
2021-04-24 01:57:41 +02:00
|
|
|
|
}
|
|
|
|
|
gls.left[3] = {
|
2021-11-05 17:44:11 +01:00
|
|
|
|
ModeSep = {
|
|
|
|
|
provider = function()
|
|
|
|
|
vim.api.nvim_command("hi GalaxyModeSep guifg=" .. mode_color[vim.fn.mode()] .. " guibg=" .. colors.bg)
|
|
|
|
|
return ""
|
|
|
|
|
end,
|
|
|
|
|
highlight = { colors.line_bg, colors.line_bg },
|
|
|
|
|
separator = " ",
|
|
|
|
|
separator_highlight = { colors.bg, colors.line_bg },
|
|
|
|
|
},
|
2021-04-24 01:57:41 +02:00
|
|
|
|
}
|
|
|
|
|
gls.left[4] = {
|
2021-11-05 17:44:11 +01:00
|
|
|
|
FileIcon = {
|
|
|
|
|
provider = "FileIcon",
|
|
|
|
|
condition = buffer_not_empty,
|
|
|
|
|
highlight = { require("galaxyline.provider_fileinfo").get_file_icon_color, colors.line_bg },
|
|
|
|
|
},
|
2021-04-24 01:57:41 +02:00
|
|
|
|
}
|
|
|
|
|
gls.left[5] = {
|
2021-11-05 17:44:11 +01:00
|
|
|
|
FileName = {
|
|
|
|
|
provider = { "FileName", "FileSize" },
|
|
|
|
|
condition = buffer_not_empty,
|
|
|
|
|
highlight = { colors.fg, colors.line_bg, "bold" },
|
|
|
|
|
},
|
2021-04-24 01:57:41 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
gls.left[6] = {
|
2021-11-05 17:44:11 +01:00
|
|
|
|
GitIcon = {
|
|
|
|
|
provider = function()
|
|
|
|
|
return " "
|
|
|
|
|
end,
|
|
|
|
|
condition = require("galaxyline.provider_vcs").check_git_workspace,
|
|
|
|
|
highlight = { colors.orange, colors.line_bg },
|
|
|
|
|
},
|
2021-04-24 01:57:41 +02:00
|
|
|
|
}
|
|
|
|
|
gls.left[7] = {
|
2021-11-05 17:44:11 +01:00
|
|
|
|
GitBranch = {
|
|
|
|
|
provider = "GitBranch",
|
|
|
|
|
condition = require("galaxyline.provider_vcs").check_git_workspace,
|
|
|
|
|
highlight = { "#8FBCBB", colors.line_bg, "bold" },
|
|
|
|
|
},
|
2021-04-24 01:57:41 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
local checkwidth = function()
|
2021-11-05 17:44:11 +01:00
|
|
|
|
local squeeze_width = vim.fn.winwidth(0) / 2
|
|
|
|
|
if squeeze_width > 40 then
|
|
|
|
|
return true
|
|
|
|
|
end
|
|
|
|
|
return false
|
2021-04-24 01:57:41 +02:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
gls.left[8] = {
|
2021-11-05 17:44:11 +01:00
|
|
|
|
DiffAdd = {
|
|
|
|
|
provider = "DiffAdd",
|
|
|
|
|
condition = checkwidth,
|
|
|
|
|
icon = " ",
|
|
|
|
|
highlight = { colors.green, colors.line_bg },
|
|
|
|
|
},
|
2021-04-24 01:57:41 +02:00
|
|
|
|
}
|
|
|
|
|
gls.left[9] = {
|
2021-11-05 17:44:11 +01:00
|
|
|
|
DiffModified = {
|
|
|
|
|
provider = "DiffModified",
|
|
|
|
|
condition = checkwidth,
|
|
|
|
|
icon = " ",
|
|
|
|
|
highlight = { colors.orange, colors.line_bg },
|
|
|
|
|
},
|
2021-04-24 01:57:41 +02:00
|
|
|
|
}
|
|
|
|
|
gls.left[10] = {
|
2021-11-05 17:44:11 +01:00
|
|
|
|
DiffRemove = {
|
|
|
|
|
provider = "DiffRemove",
|
|
|
|
|
condition = checkwidth,
|
|
|
|
|
icon = " ",
|
|
|
|
|
highlight = { colors.red, colors.line_bg },
|
|
|
|
|
},
|
2021-04-24 01:57:41 +02:00
|
|
|
|
}
|
|
|
|
|
gls.left[11] = {
|
2022-01-23 00:06:17 +01:00
|
|
|
|
TrailingWhiteSpace = {
|
|
|
|
|
provider = TrailingWhiteSpace,
|
|
|
|
|
icon = " ",
|
|
|
|
|
highlight = { colors.yellow, colors.line_bg },
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
gls.left[12] = {
|
|
|
|
|
ShowLspClient = {
|
|
|
|
|
provider = "GetLspClient",
|
|
|
|
|
icon = " ",
|
|
|
|
|
highlight = { colors.green, colors.line_bg },
|
2022-01-23 01:25:35 +01:00
|
|
|
|
},
|
2022-01-23 00:06:17 +01:00
|
|
|
|
}
|
|
|
|
|
gls.left[13] = {
|
|
|
|
|
SpaceBefore = {
|
|
|
|
|
provider = function()
|
|
|
|
|
return " "
|
|
|
|
|
end,
|
|
|
|
|
highlight = { colors.line_bg, colors.line_bg },
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
gls.left[14] = {
|
2021-11-05 17:44:11 +01:00
|
|
|
|
LeftEnd = {
|
|
|
|
|
provider = function()
|
|
|
|
|
return ""
|
|
|
|
|
end,
|
|
|
|
|
highlight = { colors.line_bg, colors.bg },
|
|
|
|
|
},
|
2021-04-24 01:57:41 +02:00
|
|
|
|
}
|
2022-01-23 00:06:17 +01:00
|
|
|
|
gls.left[15] = {
|
|
|
|
|
SpaceAfter = {
|
|
|
|
|
provider = function()
|
|
|
|
|
return " "
|
|
|
|
|
end,
|
|
|
|
|
highlight = { colors.bg, colors.bg },
|
2021-11-05 17:44:11 +01:00
|
|
|
|
},
|
2021-04-24 01:57:41 +02:00
|
|
|
|
}
|
|
|
|
|
|
2022-01-23 00:06:17 +01:00
|
|
|
|
gls.left[16] = {
|
2021-11-05 17:44:11 +01:00
|
|
|
|
DiagnosticError = {
|
|
|
|
|
provider = "DiagnosticError",
|
|
|
|
|
icon = " ",
|
|
|
|
|
highlight = { colors.red, colors.bg },
|
|
|
|
|
},
|
2021-04-24 01:57:41 +02:00
|
|
|
|
}
|
2022-01-23 00:06:17 +01:00
|
|
|
|
gls.left[17] = {
|
2021-11-05 17:44:11 +01:00
|
|
|
|
DiagnosticWarn = {
|
|
|
|
|
provider = "DiagnosticWarn",
|
|
|
|
|
icon = " ",
|
|
|
|
|
highlight = { colors.yellow, colors.bg },
|
|
|
|
|
},
|
2021-04-24 01:57:41 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
gls.right[1] = {
|
2021-11-05 17:44:11 +01:00
|
|
|
|
BufferType = {
|
|
|
|
|
provider = "FileTypeName",
|
|
|
|
|
separator = "",
|
|
|
|
|
condition = has_file_type,
|
|
|
|
|
separator_highlight = { colors.line_bg, colors.bg },
|
|
|
|
|
highlight = { colors.fg, colors.line_bg },
|
|
|
|
|
},
|
2021-04-24 22:22:12 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
gls.right[2] = {
|
2021-11-05 17:44:11 +01:00
|
|
|
|
TypeSep = {
|
|
|
|
|
provider = function()
|
|
|
|
|
return ""
|
|
|
|
|
end,
|
|
|
|
|
highlight = { colors.bg, colors.line_bg },
|
|
|
|
|
},
|
2021-04-24 22:22:12 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
gls.right[3] = {
|
2021-11-05 17:44:11 +01:00
|
|
|
|
FileFormat = {
|
|
|
|
|
provider = "FileFormat",
|
|
|
|
|
separator = "",
|
|
|
|
|
separator_highlight = { colors.line_bg, colors.bg },
|
|
|
|
|
highlight = { colors.fg, colors.line_bg, "bold" },
|
|
|
|
|
},
|
2021-04-24 01:57:41 +02:00
|
|
|
|
}
|
2021-04-24 22:22:12 +02:00
|
|
|
|
|
2021-04-24 01:57:41 +02:00
|
|
|
|
gls.right[4] = {
|
2021-11-05 17:44:11 +01:00
|
|
|
|
LineInfo = {
|
|
|
|
|
provider = "LineColumn",
|
|
|
|
|
separator = " |",
|
|
|
|
|
separator_highlight = { colors.blue, colors.line_bg },
|
|
|
|
|
highlight = { colors.fg, colors.line_bg },
|
|
|
|
|
},
|
2021-04-24 01:57:41 +02:00
|
|
|
|
}
|
|
|
|
|
gls.right[5] = {
|
2021-11-05 17:44:11 +01:00
|
|
|
|
PerCent = {
|
|
|
|
|
provider = "LinePercent",
|
|
|
|
|
highlight = { colors.cyan, colors.darkblue, "bold" },
|
|
|
|
|
},
|
2021-04-24 01:57:41 +02:00
|
|
|
|
}
|
|
|
|
|
|
2021-04-24 15:58:23 +02:00
|
|
|
|
gls.right[6] = {
|
2021-11-05 17:44:11 +01:00
|
|
|
|
ScrollBar = {
|
|
|
|
|
provider = "ScrollBar",
|
|
|
|
|
highlight = { colors.blue, colors.purple },
|
|
|
|
|
},
|
2021-04-24 01:57:41 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
gls.short_line_left[1] = {
|
2021-11-05 17:44:11 +01:00
|
|
|
|
BufferType = {
|
|
|
|
|
provider = "FileTypeName",
|
|
|
|
|
separator = "",
|
|
|
|
|
condition = has_file_type,
|
|
|
|
|
separator_highlight = { colors.purple, colors.bg },
|
|
|
|
|
highlight = { colors.fg, colors.purple },
|
|
|
|
|
},
|
2021-04-24 01:57:41 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
gls.short_line_right[1] = {
|
2021-11-05 17:44:11 +01:00
|
|
|
|
BufferIcon = {
|
|
|
|
|
provider = "BufferIcon",
|
|
|
|
|
separator = "",
|
|
|
|
|
condition = has_file_type,
|
|
|
|
|
separator_highlight = { colors.purple, colors.bg },
|
|
|
|
|
highlight = { colors.fg, colors.purple },
|
|
|
|
|
},
|
2021-04-24 01:57:41 +02:00
|
|
|
|
}
|