goolord / alpha-nvim

a lua powered greeter like vim-startify / dashboard-nvim
MIT License
1.84k stars 109 forks source link

highlight group for fortunes doesn't work #40

Closed abzcoding closed 2 years ago

abzcoding commented 2 years ago

first off, tyvm for your work on this 👍

i'm setting hl="Comment" for my footer, but sadly it doesn't work

here is the code that i'm using

local fortune = require "alpha.fortune"()
local footer = {
    type = "text",
    val = fortune,
    opts = {
      position = "center",
      hl = "Comment",
      hl_shortcut = "Comment",
    },
  }

and this is what i get

Screen Shot 2021-10-18 at 5 29 32 PM

also when i add this part

local fortune = require "alpha.fortune"()
fortune = fortune:gsub("^%s+", ""):gsub("%s+$", "")

i get sth like this

Screen Shot 2021-10-18 at 5 32 12 PM

do you have any idea why it doesn't work? here is my config in case you need it https://github.com/abzcoding/lvim/blob/main/lua/user/dashboard.lua#L50

abzcoding commented 2 years ago

the same happens with other neovim themes as well

Screen Shot 2021-10-18 at 5 34 48 PM
goolord commented 2 years ago

should be fixed in https://github.com/goolord/alpha-nvim/commit/23d90298d0ede40e80ed45db7acedc8981ae62e4

goolord commented 2 years ago

i did not inspect the fortune pr thoroughly enough ' _ '

basically the problem is that fortune was returning a string with newlines in it, which is prone to all sorts of nasty bugs so i decided newlines will be delimited by indices in a table