• Announcement: Lua.org now officially recommends this forum as a meeting place for the Lua community

Print a variable with colour as output of a lua function (1 Viewer)

shirshendu

Newcomer
Joined
Mar 30, 2022
Messages
1
Reaction score
0
I created a lua function to output the name of the git branch (to use in nvim statusline). But is it possible to output the name as coloured text (say print the output variable branchgit as blue coloured text ?

Lua:
local gitinfo = function()
  local brcmd = io.popen([[echo -n $(git rev-parse --abbrev-ref HEAD)]])
  local branchgit = brcmd:read("*a")
  brcmd:close()
  return " | " .. branchgit
end
 
Last edited:
Top