Skip to content

Commit

Permalink
Add lualine specific highlight groups and Change lualine highlight gr…
Browse files Browse the repository at this point in the history
…oup to LuaLineAerial .. symbol_kind
  • Loading branch information
JeremyWells227 committed Oct 5, 2022
1 parent cb679ac commit 69000c5
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 5 deletions.
57 changes: 57 additions & 0 deletions lua/aerial/highlight.lua
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,63 @@ M.create_highlight_groups = function()
highlight default link AerialStruct NONE
highlight default link AerialTypeParameter NONE
highlight default link AerialVariable NONE
" The icon displayed to the left of the symbol in lualine
highlight default link LuaLineAerialArrayIcon AerialArrayIcon
highlight default link LuaLineAerialBooleanIcon AerialBooleanIcon
highlight default link LuaLineAerialClassIcon AerialClassIcon
highlight default link LuaLineAerialConstantIcon AerialConstantIcon
highlight default link LuaLineAerialConstructorIcon AerialConstructorIcon
highlight default link LuaLineAerialEnumIcon AerialEnumIcon
highlight default link LuaLineAerialEnumMemberIcon AerialEnumMemberIcon
highlight default link LuaLineAerialEventIcon AerialEventIcon
highlight default link LuaLineAerialFieldIcon AerialFieldIcon
highlight default link LuaLineAerialFileIcon AerialFileIcon
highlight default link LuaLineAerialFunctionIcon AerialFunctionIcon
highlight default link LuaLineAerialInterfaceIcon AerialInterfaceIcon
highlight default link LuaLineAerialKeyIcon AerialKeyIcon
highlight default link LuaLineAerialMethodIcon AerialMethodIcon
highlight default link LuaLineAerialModuleIcon AerialModuleIcon
highlight default link LuaLineAerialNamespaceIcon AerialNamespaceIcon
highlight default link LuaLineAerialNullIcon AerialNullIcon
highlight default link LuaLineAerialNumberIcon AerialNumberIcon
highlight default link LuaLineAerialObjectIcon AerialObjectIcon
highlight default link LuaLineAerialOperatorIcon AerialOperatorIcon
highlight default link LuaLineAerialPackageIcon AerialPackageIcon
highlight default link LuaLineAerialPropertyIcon AerialPropertyIcon
highlight default link LuaLineAerialStringIcon AerialStringIcon
highlight default link LuaLineAerialStructIcon AerialStructIcon
highlight default link LuaLineAerialTypeParameterIcon AerialTypeParameterIcon
highlight default link LuaLineAerialVariableIcon AerialVariableIcon
" The name of the symbol in lualine
highlight default link LuaLineAerialArray AerialArray
highlight default link LuaLineAerialBoolean AerialBoolean
highlight default link LuaLineAerialClass AerialClass
highlight default link LuaLineAerialConstant AerialConstant
highlight default link LuaLineAerialConstructor AerialConstructor
highlight default link LuaLineAerialEnum AerialEnum
highlight default link LuaLineAerialEnumMember AerialEnumMember
highlight default link LuaLineAerialEvent AerialEvent
highlight default link LuaLineAerialField AerialField
highlight default link LuaLineAerialFile AerialFile
highlight default link LuaLineAerialFunction AerialFunction
highlight default link LuaLineAerialInterface AerialInterface
highlight default link LuaLineAerialKey AerialKey
highlight default link LuaLineAerialMethod AerialMethod
highlight default link LuaLineAerialModule AerialModule
highlight default link LuaLineAerialNamespace AerialNamespace
highlight default link LuaLineAerialNull AerialNull
highlight default link LuaLineAerialNumber AerialNumber
highlight default link LuaLineAerialObject AerialObject
highlight default link LuaLineAerialOperator AerialOperator
highlight default link LuaLineAerialPackage AerialPackage
highlight default link LuaLineAerialProperty AerialProperty
highlight default link LuaLineAerialString AerialString
highlight default link LuaLineAerialStruct AerialStruct
highlight default link LuaLineAerialTypeParameter AerialTypeParameter
highlight default link LuaLineAerialVariable AerialVariable
]])
end

Expand Down
9 changes: 4 additions & 5 deletions lua/lualine/components/aerial.lua
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,15 @@ local default_options = {

local function color_icon(symbol_kind, icon, colored)
if colored then
return string.format("%%#%s#%s%%##", "Aerial" .. symbol_kind .. "Icon", icon.." ")
return string.format("%%#%s#%s", "LuaLineAerial" .. symbol_kind .. "Icon", icon)
else
return icon
end
end

local function color(symbol_kind, text, colored)
if colored then
return string.format("%%#%s#%s", "Aerial" .. symbol_kind, text )
return string.format("%%#%s#%s", "LuaLineAerial" .. symbol_kind, text)
else
return text
end
Expand All @@ -80,12 +80,11 @@ local function format_status(symbols, depth, separator, icons_enabled, colored)
end

for _, symbol in ipairs(symbols) do
local name = color(symbol.kind, symbol.name, colored)
if icons_enabled then
local icon = color_icon(symbol.kind, symbol.icon, colored)
local name = color(symbol.kind, symbol.name, colored)
table.insert(parts, string.format("%s%s", icon, name))
table.insert(parts, string.format("%s %s", icon, name))
else
local name = color(symbol.kind, symbol.name, colored)
table.insert(parts, name)
end
end
Expand Down

0 comments on commit 69000c5

Please sign in to comment.