symbols: Setup basic highlighting for icons (using tree-sitter)

Color == cool
This commit is contained in:
simrat39
2021-04-18 21:15:06 -07:00
parent 9a95df9706
commit 7b302a938b
2 changed files with 34 additions and 31 deletions

View File

@@ -89,9 +89,14 @@ end
local function setup_highlights() local function setup_highlights()
-- markers -- markers
highlight_text(markers.middle, markers.middle, "Comment") highlight_text("marker_middle", markers.middle, "Comment")
highlight_text(markers.horizontal, markers.horizontal, "Comment") highlight_text("markers_horizontal", markers.horizontal, "Comment")
highlight_text(markers.bottom, markers.bottom, "Comment") highlight_text("markers_bottom", markers.bottom, "Comment")
for _, value in ipairs(symbols.kinds) do
local symbol = symbols[value]
highlight_text(value, symbol.icon, symbol.hl)
end
end end
local function write(outline_items, bufnr, winnr) local function write(outline_items, bufnr, winnr)

View File

@@ -1,30 +1,30 @@
M = {} M = {}
M.File = "" M.File = {icon = "", hl = "TSURI"}
M.Module = "" M.Module = {icon = "", hl = "TSNamespace"}
M.Namespace = "" M.Namespace = {icon = "", hl = "TSNamespace"}
M.Package = "" M.Package = {icon = "", hl = "TSNamespace"}
M.Class = "𝓒" M.Class = {icon = "𝓒", hl = "TSType"}
M.Method = "ƒ" M.Method = {icon = "ƒ", hl = "TSMethod"}
M.Property = "" M.Property = {icon = "", hl = "TSMethod"}
M.Field = "" M.Field = {icon = "", hl = "TSField"}
M.Constructor = "" M.Constructor = {icon = "", hl = "TSConstructor"}
M.Enum = "" M.Enum = {icon = "", hl = "TSType"}
M.Interface = "" M.Interface = {icon = "", hl = "TSType"}
M.Function = "" M.Function = {icon = "", hl = "TSFunction"}
M.Variable = "" M.Variable = {icon = "", hl = "TSConstant"}
M.Constant = "" M.Constant = {icon = "", hl = "TSConstant"}
M.String = "𝓐" M.String = {icon = "𝓐", hl = "TSString"}
M.Number = "#" M.Number = {icon = "#", hl = "TSNumber"}
M.Boolean = "" M.Boolean = {icon = "", hl = "TSBoolean"}
M.Array = "" M.Array = {icon = "", hl = "TSConstant"}
M.Object = "⦿" M.Object = {icon = "⦿", hl = "TSType"}
M.Key = "🔐" M.Key = {icon = "🔐", hl = "TSType"}
M.Null = "NULL" M.Null = {icon = "NULL", hl = "TSType"}
M.EnumMember = "" M.EnumMember = {icon = "", hl = "TSField"}
M.Struct = "𝓢" M.Struct = {icon = "𝓢", hl = "TSType"}
M.Event = "🗲" M.Event = {icon = "🗲", hl = "TSType"}
M.Operator = "𝒯" M.Operator = {icon = "𝒯", hl = "TSOperator"}
M.kinds = { M.kinds = {
"File", "Module", "Namespace", "Package", "Class", "Method", "Property", "File", "Module", "Namespace", "Package", "Class", "Method", "Property",
@@ -33,8 +33,6 @@ M.kinds = {
"EnumMember", "Struct", "Event", "Operator" "EnumMember", "Struct", "Event", "Operator"
} }
function M.icon_from_kind(kind) function M.icon_from_kind(kind) return M[M.kinds[kind]].icon end
return M[M.kinds[kind]]
end
return M return M