Closed ckt114 closed 1 year ago
@ckt114 check our extended_integrations option in core/default_cofnig.lua and add alpha to it
then load the alpha hl group by
dofile(vim.g.base46_cache .. "alpha")
put it in custom/init.lua, i'll add docs for this tomorrow
@siduck Do I need to do anything after adding those lines? I did it and I get error below. I checked the path /Users/ckt114/.local/share/nvim/nvchad/base46
and there's no alpha
file in there.
Error detected while processing /Users/ckt114/.config/nvim/init.lua:
E5113: Error while calling lua chunk: cannot open /Users/ckt114/.local/share/nvim/nvchad/base46/alpha: No such file or directory
stack traceback:
[C]: in function 'dofile'
/Users/ckt114/.config/nvim/lua/custom/init.lua:59: in main chunk
[C]: in function 'dofile'
/Users/ckt114/.config/nvim/init.lua:6: in main chunk
Press ENTER or type command to continue
So I had to delete ~/.local/share/nvim
and ~/.local/state/nvim
and restart nvim for it to run the bootstrap again and it created that /Users/ckt114/.local/share/nvim/nvchad/base46/alpha
file and the error goes away but it still didn't work. I did add lines below into respective files.
custom/chadrc.lua
M.ui = {
...
extended_integrations = { "alpha" },
...
}
custom/init.lua
...
dofile(vim.g.base46_cache .. "alpha")
@ckt114
@siduck Do I need to do anything after adding those lines? I did it and I get error below. I checked the path
/Users/ckt114/.local/share/nvim/nvchad/base46
and there's noalpha
file in there.Error detected while processing /Users/ckt114/.config/nvim/init.lua: E5113: Error while calling lua chunk: cannot open /Users/ckt114/.local/share/nvim/nvchad/base46/alpha: No such file or directory stack traceback: [C]: in function 'dofile' /Users/ckt114/.config/nvim/lua/custom/init.lua:59: in main chunk [C]: in function 'dofile' /Users/ckt114/.config/nvim/init.lua:6: in main chunk Press ENTER or type command to continue
works for me, watch the video
Do you mind pasting the content of how you include alpha in custom/plugins.lua
? Mine is below. I did remove the event = "VimEnter"
as well but still not working. Also tried cmd = "Alpha"
but no dice.
{
"goolord/alpha-nvim",
event = "VimEnter",
requires = { "nvim-tree/nvim-web-devicons" },
config = function()
local startify = require "alpha.themes.startify"
require "alpha".setup(startify.config)
end,
}
So I checked the highlights like you did and it showed that the colors alpha won't be correct until :Telescope
is ran. You run :Alpha
right after entering nvim, don't run :Telescope
, and you'll see it's not coloring right for the theme.
So I checked the highlights like you did and it showed that the colors alpha won't be correct until
:Telescope
is ran. You run:Alpha
right after entering nvim, don't run:Telescope
, and you'll see it's not coloring right for the theme.
our hl groups dont apply because you're using default alpha config
@ckt114
{
"goolord/alpha-nvim",
event = "VimEnter",
config = function()
local function button(sc, txt, keybind)
local sc_ = sc:gsub("%s", ""):gsub("SPC", "<leader>")
local opts = {
position = "center",
text = txt,
shortcut = sc,
cursor = 5,
width = 36,
align_shortcut = "right",
hl = "AlphaButtons",
}
if keybind then
opts.keymap = { "n", sc_, keybind, { noremap = true, silent = true } }
end
return {
type = "button",
val = txt,
on_press = function()
local key = vim.api.nvim_replace_termcodes(sc_, true, false, true) or ""
vim.api.nvim_feedkeys(key, "normal", false)
end,
opts = opts,
}
end
-- dynamic header padding
local fn = vim.fn
local marginTopPercent = 0.3
local headerPadding = fn.max { 2, fn.floor(fn.winheight(0) * marginTopPercent) }
local options = {
header = {
type = "text",
val = {
" ⠙⠃ ⣼⣿⡟ ⠈⠻⣿⣿⣦⣌⡇⠻⣿⣿⣷⣿⣿⣿ ⣿⣿⡇ ⠛⠻⢷⣄ ",
" ⢻⣿⣿⣄ ⠈⠻⣿⣿⣿⣷⣿⣿⣿⣿⣿⡟ ⠫⢿⣿⡆ ",
" ⠻⣿⣿⣿⣿⣶⣶⣾⣿⣿⣿⣿⣿⣿⣿⣿⡟⢀⣀⣤⣾⡿⠃ ",
},
opts = {
position = "center",
hl = "AlphaHeader",
},
},
buttons = {
type = "group",
val = {
button("SPC f f", " Find File ", ":Telescope find_files<CR>"),
button("SPC f o", " Recent File ", ":Telescope oldfiles<CR>"),
button("SPC f w", " Find Word ", ":Telescope live_grep<CR>"),
button("SPC b m", " Bookmarks ", ":Telescope marks<CR>"),
button("SPC t h", " Themes ", ":Telescope themes<CR>"),
button("SPC e s", " Settings", ":e $MYVIMRC | :cd %:p:h <CR>"),
},
opts = {
spacing = 1,
},
},
headerPaddingTop = { type = "padding", val = headerPadding },
headerPaddingBottom = { type = "padding", val = 2 },
}
require("alpha").setup {
layout = {
options.headerPaddingTop,
options.header,
options.headerPaddingBottom,
options.buttons,
},
}
-- load hl groups
dofile(vim.g.base46_cache .. "alpha")
end,
},
we just define 2 highlight groups for alpha, i'd suggest creating your own , put them into hl_add field of the UI field in chadrc. Read our themeing docs properly
@siduck What I mean is why doesn’t nvchad load the theme correctly for alpha? I’m not customizing alpha colors, just want it to take whatever color the current theme gives it. You see in my two screenshots above that the first one is when I start nvim and the second one is after I opened a buffer or telescope then open alpha. It’s fine if this is not something that’s solvable. I use alpha with AstroNvim and LazyVim and they work fine for alpha but not NvChad.
@siduck What I mean is why doesn’t nvchad load the theme correctly for alpha? I’m not customizing alpha colors, just want it to take whatever color the current theme gives it. You see in my two screenshots above that the first one is when I start nvim and the second one is after I opened a buffer or telescope then open alpha. It’s fine if this is not something that’s solvable. I use alpha with AstroNvim and LazyVim and they work fine for alpha but not NvChad.
did you even run the compiled cache for alpha? No :/
alpha isnt even used by nvchad so i put it in the extended integrations dir so users who want it can include it in chadrc and load its hl group by dofile .
Because in the future there will be tons of support for external plugins and then it would be too heavy to load all hl groups when we reload the theme, so we reload only what we & user needs
Ok that’s fine. Not a bit deal. I can live with it. Maybe I’ll do some autocommand hack to start telescope first and then run alpha so it’ll load the color correctly.
Ok that’s fine. Not a bit deal. I can live with it. Maybe I’ll do some autocommand hack to start telescope first and then run alpha so it’ll load the color correctly.
dude all you have to do is run that dofile code in your custom/init.lua, is that hard? :angry:
I did. It doesn’t work.
I did. It doesn’t work.
its hard to believe
works for me, watch the video
watch it, a clear proof that it works
please save your chadrc after added alpha to extended_Integrations, or else it wont compile And please use only neovim to edit your custom files or else none of our base46 stuff would recompile
Yes and yes. I did save it and I only use neovim. You never ran :Alpha
in that video of yours. Open neovim, run :Alpha
, note the colors, run :Telescope
, quit telescope, and run :Alpha
again.
Yes and yes. I did save it and I only use neovim. You never ran
:Alpha
in that video of yours. Open neovim, run:Alpha
, note the colors, run:Telescope
, quit telescope, and run:Alpha
again.
works for me?
did you even define our highlight groups in your alpha config? No
Ok let’s forget about it.
Ok wait i see what you mean now
after selecting the theme with telescope
seems like alpha's taking hl groups from some of our non default hl groups
our telescope theme switcher loads all hl groups so alpha looks normal too ig
we should see which hl groups alpha uses
yea they use syntax hl groups
so just add this in your alpha config function
dofile(vim.g.base46_cache .. "syntax")
I'll try to add startify alike dashboard theme for our current dashboard in nvchad v3.0
Ok I’ll try your suggestions. Thank you.
I've only started noticing this when I use
goolord/alpha-nvim
that the colors from the color scheme does not get applied until after a buffer is opened or start nvim with a buffer param. Below are the screenshots of before and after of thekanagawa
theme. Is there a way for me to load all the highlights on VimEnter? TIA.Running nvim without a buffer and run
:Alpha
After opening a buffer or start vim with a buffer like
nvim file
.