2021-10-16 18:00:48 +02:00
|
|
|
|
--[[ local vi_mode_utils = require 'feline.providers.vi_mode'
|
|
|
|
|
|
|
|
|
|
|
|
local vi_mode_colors = {
|
|
|
|
|
|
NORMAL = "#8cc85f",
|
|
|
|
|
|
INSERT = "#ff5454",
|
|
|
|
|
|
VISUAL = "#ae81ff",
|
|
|
|
|
|
OP = "#36c692",
|
|
|
|
|
|
BLOCK = "#80a0ff",
|
|
|
|
|
|
REPLACE = "#d183e8",
|
|
|
|
|
|
['V-REPLACE'] = "#d183e8",
|
|
|
|
|
|
ENTER = "#74b2ff",
|
|
|
|
|
|
MORE = "#74b2ff",
|
|
|
|
|
|
SELECT = "#de935f",
|
|
|
|
|
|
COMMAND = "#8cc85f",
|
|
|
|
|
|
SHELL = "#8cc85f",
|
|
|
|
|
|
TERM = "#8cc85f",
|
|
|
|
|
|
NONE = "#e3c78a"
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
local function vimode_hl()
|
|
|
|
|
|
return {
|
|
|
|
|
|
name = vi_mode_utils.get_mode_highlight_name(),
|
|
|
|
|
|
fg = vi_mode_utils.get_mode_color()
|
|
|
|
|
|
}
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
local cmps = {
|
|
|
|
|
|
vi_mode = {
|
|
|
|
|
|
provider = '▊',
|
|
|
|
|
|
hl = vimode_hl,
|
|
|
|
|
|
right_sep = ' '
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
local components = {
|
|
|
|
|
|
left = {
|
|
|
|
|
|
active = {
|
|
|
|
|
|
cmps.vi_mode
|
|
|
|
|
|
},
|
|
|
|
|
|
inactive = {}
|
|
|
|
|
|
},
|
|
|
|
|
|
mid = {
|
|
|
|
|
|
active = {},
|
|
|
|
|
|
inactive = {}
|
|
|
|
|
|
},
|
|
|
|
|
|
right = {
|
|
|
|
|
|
active = {},
|
|
|
|
|
|
inactive = {}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
require'feline'.setup {
|
|
|
|
|
|
components = components,
|
|
|
|
|
|
vi_mode_colors = vi_mode_colors
|
|
|
|
|
|
} ]]
|
|
|
|
|
|
|
2021-11-05 23:28:40 +01:00
|
|
|
|
local gl = require("galaxyline")
|
2021-06-20 18:55:56 +02:00
|
|
|
|
local gls = gl.section
|
2021-11-05 23:28:40 +01:00
|
|
|
|
gl.short_line_list = { "LuaTree", "vista", "dbui" }
|
2021-06-20 18:55:56 +02:00
|
|
|
|
|
|
|
|
|
|
local colors = {
|
2021-11-05 23:28:40 +01:00
|
|
|
|
bg = "#282c34",
|
|
|
|
|
|
yellow = "#fabd2f",
|
|
|
|
|
|
cyan = "#008080",
|
|
|
|
|
|
darkblue = "#081633",
|
|
|
|
|
|
green = "#afd700",
|
|
|
|
|
|
orange = "#FF8800",
|
|
|
|
|
|
purple = "#5d4d7a",
|
|
|
|
|
|
magenta = "#d16d9e",
|
|
|
|
|
|
grey = "#c0c0c0",
|
|
|
|
|
|
blue = "#0087d7",
|
|
|
|
|
|
red = "#ec5f67",
|
|
|
|
|
|
violet = "#6860e7",
|
2021-06-20 18:55:56 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
local buffer_not_empty = function()
|
2021-11-05 23:28:40 +01:00
|
|
|
|
if vim.fn.empty(vim.fn.expand("%:t")) ~= 1 then
|
2021-06-20 18:55:56 +02:00
|
|
|
|
return true
|
|
|
|
|
|
end
|
|
|
|
|
|
return false
|
|
|
|
|
|
end
|
|
|
|
|
|
|
2021-10-16 18:00:48 +02:00
|
|
|
|
local fileinfo = require("galaxyline.providers.fileinfo")
|
|
|
|
|
|
|
2021-06-20 18:55:56 +02:00
|
|
|
|
-- Start of line
|
|
|
|
|
|
gls.left[1] = {
|
|
|
|
|
|
FirstElement = {
|
2021-11-05 23:28:40 +01:00
|
|
|
|
provider = function()
|
|
|
|
|
|
return "▋"
|
|
|
|
|
|
end,
|
|
|
|
|
|
highlight = { colors.blue, colors.yellow },
|
2021-06-20 18:55:56 +02:00
|
|
|
|
},
|
|
|
|
|
|
}
|
|
|
|
|
|
-- Vim mode
|
|
|
|
|
|
gls.left[2] = {
|
|
|
|
|
|
ViMode = {
|
|
|
|
|
|
provider = function()
|
2021-11-05 23:28:40 +01:00
|
|
|
|
local alias = { n = "NORMAL ", i = "INSERT ", c = "COMMAND ", V = "VISUAL ", [""] = "VISUAL " }
|
2021-06-20 18:55:56 +02:00
|
|
|
|
return alias[vim.fn.mode()]
|
|
|
|
|
|
end,
|
2021-11-05 23:28:40 +01:00
|
|
|
|
separator = "",
|
|
|
|
|
|
separator_highlight = {
|
|
|
|
|
|
colors.yellow,
|
|
|
|
|
|
function()
|
|
|
|
|
|
if not buffer_not_empty() then
|
|
|
|
|
|
return colors.purple
|
|
|
|
|
|
end
|
|
|
|
|
|
return colors.darkblue
|
|
|
|
|
|
end,
|
|
|
|
|
|
},
|
|
|
|
|
|
highlight = { colors.violet, colors.yellow, "bold" },
|
2021-06-20 18:55:56 +02:00
|
|
|
|
},
|
|
|
|
|
|
}
|
|
|
|
|
|
-- File Icon
|
2021-11-05 23:28:40 +01:00
|
|
|
|
gls.left[3] = {
|
2021-06-20 18:55:56 +02:00
|
|
|
|
FileIcon = {
|
2021-11-05 23:28:40 +01:00
|
|
|
|
provider = "FileIcon",
|
2021-06-20 18:55:56 +02:00
|
|
|
|
condition = buffer_not_empty,
|
2021-11-05 23:28:40 +01:00
|
|
|
|
highlight = { fileinfo.get_file_icon_color, colors.darkblue },
|
2021-06-20 18:55:56 +02:00
|
|
|
|
},
|
|
|
|
|
|
}
|
|
|
|
|
|
-- File Name
|
|
|
|
|
|
gls.left[4] = {
|
|
|
|
|
|
FileName = {
|
2021-11-05 23:28:40 +01:00
|
|
|
|
provider = { "FileName" },
|
2021-06-20 18:55:56 +02:00
|
|
|
|
condition = buffer_not_empty,
|
2021-11-05 23:28:40 +01:00
|
|
|
|
separator = "",
|
|
|
|
|
|
separator_highlight = { colors.purple, colors.darkblue },
|
|
|
|
|
|
highlight = { colors.magenta, colors.darkblue },
|
|
|
|
|
|
},
|
2021-06-20 18:55:56 +02:00
|
|
|
|
}
|
|
|
|
|
|
-- GIT
|
|
|
|
|
|
gls.left[5] = {
|
|
|
|
|
|
GitIcon = {
|
2021-11-05 23:28:40 +01:00
|
|
|
|
provider = function()
|
|
|
|
|
|
return " "
|
|
|
|
|
|
end,
|
2021-06-20 18:55:56 +02:00
|
|
|
|
condition = buffer_not_empty,
|
2021-11-05 23:28:40 +01:00
|
|
|
|
highlight = { colors.orange, colors.purple },
|
|
|
|
|
|
},
|
2021-06-20 18:55:56 +02:00
|
|
|
|
}
|
|
|
|
|
|
gls.left[6] = {
|
|
|
|
|
|
GitBranch = {
|
2021-11-05 23:28:40 +01:00
|
|
|
|
provider = "GitBranch",
|
2021-06-20 18:55:56 +02:00
|
|
|
|
condition = buffer_not_empty,
|
2021-11-05 23:28:40 +01:00
|
|
|
|
highlight = { colors.grey, colors.purple },
|
|
|
|
|
|
},
|
2021-06-20 18:55:56 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
2021-10-16 18:00:48 +02:00
|
|
|
|
local vcs = require("galaxyline.providers.vcs")
|
2021-06-20 18:55:56 +02:00
|
|
|
|
|
2021-11-05 23:28:40 +01:00
|
|
|
|
local is_file_diff = function()
|
2021-06-20 18:55:56 +02:00
|
|
|
|
if vcs.diff_add() ~= nil or vcs.diff_modified() ~= nil or vcs.diff_remove() ~= nil then
|
2021-11-05 23:28:40 +01:00
|
|
|
|
return ""
|
2021-06-20 18:55:56 +02:00
|
|
|
|
end
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
gls.left[7] = {
|
|
|
|
|
|
GitModified = {
|
|
|
|
|
|
provider = is_file_diff,
|
2021-11-05 23:28:40 +01:00
|
|
|
|
highlight = { colors.green, colors.purple },
|
|
|
|
|
|
},
|
2021-06-20 18:55:56 +02:00
|
|
|
|
}
|
|
|
|
|
|
gls.left[8] = {
|
|
|
|
|
|
LeftEnd = {
|
2021-11-05 23:28:40 +01:00
|
|
|
|
provider = function()
|
|
|
|
|
|
return ""
|
|
|
|
|
|
end,
|
|
|
|
|
|
separator = "",
|
|
|
|
|
|
separator_highlight = { colors.purple, colors.bg },
|
|
|
|
|
|
highlight = { colors.purple, colors.purple },
|
|
|
|
|
|
},
|
2021-06-20 18:55:56 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
2021-11-05 23:28:40 +01:00
|
|
|
|
local lsp_diag_error = function()
|
|
|
|
|
|
local diagnostics = require("lsp-status/diagnostics")
|
2021-06-20 18:55:56 +02:00
|
|
|
|
local buf_diagnostics = diagnostics()
|
|
|
|
|
|
|
|
|
|
|
|
if buf_diagnostics.errors and buf_diagnostics.errors > 0 then
|
2021-11-05 23:28:40 +01:00
|
|
|
|
return buf_diagnostics.errors .. " "
|
2021-06-20 18:55:56 +02:00
|
|
|
|
end
|
|
|
|
|
|
end
|
2021-11-05 23:28:40 +01:00
|
|
|
|
local lsp_diag_warn = function()
|
|
|
|
|
|
local diagnostics = require("lsp-status/diagnostics")
|
2021-06-20 18:55:56 +02:00
|
|
|
|
local buf_diagnostics = diagnostics()
|
|
|
|
|
|
|
|
|
|
|
|
if buf_diagnostics.warnings and buf_diagnostics.warnings > 0 then
|
2021-11-05 23:28:40 +01:00
|
|
|
|
return buf_diagnostics.warnings .. " "
|
2021-06-20 18:55:56 +02:00
|
|
|
|
end
|
|
|
|
|
|
end
|
2021-11-05 23:28:40 +01:00
|
|
|
|
local lsp_diag_info = function()
|
|
|
|
|
|
local diagnostics = require("lsp-status/diagnostics")
|
2021-06-20 18:55:56 +02:00
|
|
|
|
local buf_diagnostics = diagnostics()
|
|
|
|
|
|
|
|
|
|
|
|
if buf_diagnostics.info and buf_diagnostics.info > 0 then
|
2021-11-05 23:28:40 +01:00
|
|
|
|
return buf_diagnostics.info .. " "
|
2021-06-20 18:55:56 +02:00
|
|
|
|
end
|
|
|
|
|
|
end
|
2021-11-05 23:28:40 +01:00
|
|
|
|
local has_lsp = function()
|
2021-06-20 18:55:56 +02:00
|
|
|
|
return #vim.lsp.buf_get_clients() > 0
|
|
|
|
|
|
end
|
|
|
|
|
|
|
2021-11-05 23:28:40 +01:00
|
|
|
|
local has_curent_func = function()
|
2021-06-20 18:55:56 +02:00
|
|
|
|
if not has_lsp then
|
|
|
|
|
|
return false
|
|
|
|
|
|
end
|
|
|
|
|
|
local current_function = vim.b.lsp_current_function
|
2021-11-05 23:28:40 +01:00
|
|
|
|
return current_function and current_function ~= ""
|
2021-06-20 18:55:56 +02:00
|
|
|
|
end
|
2021-11-05 23:28:40 +01:00
|
|
|
|
local lsp_current_func = function()
|
2021-06-20 18:55:56 +02:00
|
|
|
|
local current_function = vim.b.lsp_current_function
|
2021-11-05 23:28:40 +01:00
|
|
|
|
if current_function and current_function ~= "" then
|
|
|
|
|
|
return "(" .. current_function .. ") "
|
2021-06-20 18:55:56 +02:00
|
|
|
|
end
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
gls.right[1] = {
|
|
|
|
|
|
LspText = {
|
2021-11-05 23:28:40 +01:00
|
|
|
|
provider = function()
|
|
|
|
|
|
return ""
|
|
|
|
|
|
end,
|
|
|
|
|
|
separator = "",
|
|
|
|
|
|
separator_highlight = { colors.darkblue, colors.bg },
|
|
|
|
|
|
highlight = { colors.grey, colors.darkblue },
|
|
|
|
|
|
},
|
2021-06-20 18:55:56 +02:00
|
|
|
|
}
|
|
|
|
|
|
gls.right[2] = {
|
|
|
|
|
|
LspError = {
|
|
|
|
|
|
provider = lsp_diag_error,
|
|
|
|
|
|
condition = has_lsp,
|
2021-11-05 23:28:40 +01:00
|
|
|
|
icon = " ",
|
|
|
|
|
|
highlight = { colors.grey, colors.darkblue },
|
|
|
|
|
|
},
|
2021-06-20 18:55:56 +02:00
|
|
|
|
}
|
|
|
|
|
|
gls.right[3] = {
|
|
|
|
|
|
LspWarning = {
|
|
|
|
|
|
provider = lsp_diag_warn,
|
|
|
|
|
|
condition = has_lsp,
|
2021-11-05 23:28:40 +01:00
|
|
|
|
icon = " ",
|
|
|
|
|
|
highlight = { colors.grey, colors.darkblue },
|
|
|
|
|
|
},
|
2021-06-20 18:55:56 +02:00
|
|
|
|
}
|
|
|
|
|
|
gls.right[4] = {
|
|
|
|
|
|
LspInfo = {
|
|
|
|
|
|
provider = lsp_diag_info,
|
|
|
|
|
|
condition = has_lsp,
|
2021-11-05 23:28:40 +01:00
|
|
|
|
icon = " ",
|
|
|
|
|
|
highlight = { colors.grey, colors.darkblue },
|
|
|
|
|
|
},
|
2021-06-20 18:55:56 +02:00
|
|
|
|
}
|
|
|
|
|
|
gls.right[5] = {
|
|
|
|
|
|
LspCurrentFunc = {
|
|
|
|
|
|
provider = lsp_current_func,
|
|
|
|
|
|
condition = has_current_func,
|
2021-11-05 23:28:40 +01:00
|
|
|
|
icon = "𝒇",
|
|
|
|
|
|
highlight = { colors.grey, colors.darkblue },
|
|
|
|
|
|
},
|
2021-06-20 18:55:56 +02:00
|
|
|
|
}
|
2021-11-05 23:28:40 +01:00
|
|
|
|
gls.right[6] = {
|
2021-06-20 18:55:56 +02:00
|
|
|
|
FileFormat = {
|
2021-11-05 23:28:40 +01:00
|
|
|
|
provider = "FileFormat",
|
|
|
|
|
|
separator = "",
|
|
|
|
|
|
separator_highlight = { colors.darkblue, colors.purple },
|
|
|
|
|
|
highlight = { colors.grey, colors.purple },
|
|
|
|
|
|
},
|
2021-06-20 18:55:56 +02:00
|
|
|
|
}
|
|
|
|
|
|
gls.right[7] = {
|
|
|
|
|
|
LineInfo = {
|
2021-11-05 23:28:40 +01:00
|
|
|
|
provider = "LineColumn",
|
|
|
|
|
|
separator = " | ",
|
|
|
|
|
|
separator_highlight = { colors.darkblue, colors.purple },
|
|
|
|
|
|
highlight = { colors.grey, colors.purple },
|
2021-06-20 18:55:56 +02:00
|
|
|
|
},
|
|
|
|
|
|
}
|
|
|
|
|
|
gls.right[8] = {
|
|
|
|
|
|
PerCent = {
|
2021-11-05 23:28:40 +01:00
|
|
|
|
provider = "LinePercent",
|
|
|
|
|
|
separator = "",
|
|
|
|
|
|
separator_highlight = { colors.darkblue, colors.purple },
|
|
|
|
|
|
highlight = { colors.grey, colors.darkblue },
|
|
|
|
|
|
},
|
2021-06-20 18:55:56 +02:00
|
|
|
|
}
|
|
|
|
|
|
gls.right[9] = {
|
|
|
|
|
|
ScrollBar = {
|
2021-11-05 23:28:40 +01:00
|
|
|
|
provider = "ScrollBar",
|
|
|
|
|
|
highlight = { colors.yellow, colors.purple },
|
|
|
|
|
|
},
|
2021-06-20 18:55:56 +02:00
|
|
|
|
}
|