Open KapJ1coH opened 2 hours ago
As an example, here's my repro with my config for alpha.nvim in which the dashboard shows up.
-- Alpha (dashboard) for neovim
local options
-- Only runs this script if Alpha Screen loads -- only if there isn't files to read
if (vim.api.nvim_exec('echo argc()', true) == "0")
then
--math.randomseed( os.time() ) -- For random header.
-- Create button for initial keybind.
--- @param sc string
--- @param txt string
--- @param hl string
--- @param keybind string optional
--- @param keybind_opts table optional
local function button(sc, txt, hl, keybind, keybind_opts)
local sc_ = sc:gsub("%s", ""):gsub("SPC", "<leader>")
local opts = {
position = "center",
shortcut = sc,
cursor = 5,
width = 50,
align_shortcut = "right",
hl_shortcut = hl,
}
if keybind then
keybind_opts = vim.F.if_nil(keybind_opts, { noremap = true, silent = true, nowait = true })
opts.keymap = { "n", sc_, keybind, keybind_opts }
end
local function on_press()
local key = vim.api.nvim_replace_termcodes(sc_ .. '<Ignore>', true, false, true)
vim.api.nvim_feedkeys(key, "normal", false)
end
return {
type = "button",
val = txt,
on_press = on_press,
opts = opts,
}
end
-- All custom headers
Headers = {
{
[[ .-'''''-. ]],
[[ .' `. ]],
[[ : : ]],
[[ : :]],
[[ : _/| :]],
[[ : =/_/ : ]],
[[ `._/ | .' ]],
[[ ( / ,|...-' ]],
[[ \_/^\/||__ ]],
[[ _/~ `""~`"` \_ ]],
[[ __/ -'. ` . `\_\__ ]],
[[/jgs \ \-.\ ]],
}, -- jgs
{
[[================= =============== =============== ======== ========]],
[[\\ . . . . . . .\\ //. . . . . . .\\ //. . . . . . .\\ \\. . .\\// . . //]],
[[||. . ._____. . .|| ||. . ._____. . .|| ||. . ._____. . .|| || . . .\/ . . .||]],
[[|| . .|| ||. . || || . .|| ||. . || || . .|| ||. . || ||. . . . . . . ||]],
[[||. . || || . .|| ||. . || || . .|| ||. . || || . .|| || . | . . . . .||]],
[[|| . .|| ||. _-|| ||-_ .|| ||. . || || . .|| ||. _-|| ||-_.|\ . . . . ||]],
[[||. . || ||-' || || `-|| || . .|| ||. . || ||-' || || `|\_ . .|. .||]],
[[|| . _|| || || || || ||_ . || || . _|| || || || |\ `-_/| . ||]],
[[||_-' || .|/ || || \|. || `-_|| ||_-' || .|/ || || | \ / |-_.||]],
[[|| ||_-' || || `-_|| || || ||_-' || || | \ / | `||]],
[[|| `' || || `' || || `' || || | \ / | ||]],
[[|| .===' `===. .==='.`===. .===' /==. | \/ | ||]],
[[|| .==' \_|-_ `===. .===' _|_ `===. .===' _-|/ `== \/ | ||]],
[[|| .==' _-' `-_ `=' _-' `-_ `=' _-' `-_ /| \/ | ||]],
[[|| .==' _-' '-__\._-' '-_./__-' `' |. /| | ||]],
[[||.==' _-' `' | /==.||]],
[[==' _-' N E O V I M \/ `==]],
[[\ _-' `-_ /]],
[[ `'' ``' ]],
},
}
--
-- Sections for Alpha.
--
local header = {
type = "text",
val = Headers[math.random(#Headers)],
-- val = Headers[1],
opts = {
position = "center",
hl = "Whitespace"
-- wrap = "overflow";
}
}
local footer = {
type = "text",
-- Change 'rdn' to any program that gives you a random quote.
-- https://github.com/BeyondMagic/scripts/blob/master/quotes/rdn
-- Which returns one to three lines, being each divided by a line break.
-- Or just an array: { "I see you:", "Above you." }
val = {
"We accept the love we think we deserve.",
" Mr. Callahan",
"The Perks of Being a Wallflower",
},
hl = "NvimTreeRootFolder",
opts = {
position = "center",
hl = "Whitespace",
}
}
local buttons = {
type = "group",
val = {
button("e", " New Buffer", 'RainbowRed', ':tabnew<CR>'),
button("f", " Find file", 'RainbowYellow', ':Telescope find_files<CR>'),
button("h", " Recently opened files", 'RainbowBlue', ':Telescope oldfiles<CR>'),
button("l", " Projects", 'RainbowOrange', ':Telescope marks<CR>'),
button("r", " Frecency/MRU", 'RainbowCyan', ':Telescope oldfiles<CR>'),
button("g", " Open Last Session", 'RainbowGreen', ':source ~/.config/nvim/session.vim<CR>'),
button("m", " Word Finder", 'RainbowViolet', ':Telescope live_grep<CR>'),
},
opts = {
spacing = 1,
}
}
--
-- Centering handler of ALPHA
--
local ol = { -- occupied lines
icon = #header.val, -- CONST: number of lines that your header will occupy
message = #footer.val, -- CONST: because of padding at the bottom
length_buttons = #buttons.val * 2 - 1, -- CONST: it calculate the number that buttons will occupy
neovim_lines = 2, -- CONST: 2 of command line, 1 of the top bar
padding_between = 3, -- STATIC: can be set to anything, padding between keybinds and header
}
local left_terminal_value = vim.api.nvim_get_option('lines') -
(ol.length_buttons + ol.message + ol.padding_between + ol.icon + ol.neovim_lines)
-- Not screen enough to run the command.
if (left_terminal_value >= 0) then
local top_padding = math.floor(left_terminal_value / 2)
local bottom_padding = left_terminal_value - top_padding
--
-- Set alpha sections
--
options = {
layout = {
{ type = "padding", val = top_padding },
header,
{ type = "padding", val = ol.padding_between },
buttons,
footer,
{ type = "padding", val = bottom_padding },
},
opts = {
margin = 5
},
}
end
--else
--vim.api.nvim_exec('silent source ~/.config/nvim/session.vim', false)
end
vim.env.LAZY_STDPATH = ".repro"
load(vim.fn.system("curl -s https://raw.githubusercontent.com/folke/lazy.nvim/main/bootstrap.lua"))()
require("lazy.minit").repro({
spec = {
{
"goolord/alpha-nvim",
dependencies = { 'nvim-tree/nvim-web-devicons', },
lazy = false,
-- enabled = false,
config = function()
if (options ~= nil) then
require 'alpha'.setup(options)
end
end
},
},
})
Your snacks repro is all wrong. So that code could never work. Did you actually test it?
I've just updated my plugin and added dashboard to snacks config, and my isn't launching automatically either. It looks great when I launch it manually though so thank you for this addition :)
https://github.com/dseravalli/nvim.config/blob/main/lua/dseravalli/lazy/snacks.lua#L7
macos, latest versions of nvim, lazy, and snacks
I just updated it, it was a mistype. I tested both repros and the snack one shows this The snacks plugin still works, for example the terminal pop-up is showing up.
Let me know if my config is still wrong, it is very much a possibility
Can you update snacks, run :checkhealth snacks
and report back with the output?
Just added a bunch of health checks to narrow down the issue
==============================================================================
snacks: require("snacks.health").check()
Snacks ~
- OK setup called
Snacks.bigfile ~
- OK setup {enabled}
Snacks.dashboard ~
- OK setup {enabled}
- OK setup ran
- WARNING dashboard did not open: `stdin is a pipe`
Snacks.lazygit ~
- OK {lazygit} installed
Snacks.notifier ~
- OK setup {enabled}
- OK is ready
Snacks.quickfile ~
- OK setup {enabled}
Snacks.statuscolumn ~
- OK setup {enabled}
Snacks.terminal ~
- OK shell configured
- `vim.o.shell`: /bin/zsh
- `parsed`: { "/bin/zsh" }
Snacks.toggle ~
- OK {which-key} is installed
Snacks.words ~
- OK setup {enabled}
I am having the same issue. Here is my checkhealth output.
==============================================================================
snacks: require("snacks.health").check()
Snacks ~
- OK setup called
Snacks.bigfile ~
- WARNING setup {disabled}
Snacks.dashboard ~
- OK setup {enabled}
Snacks.lazygit ~
- ERROR {lazygit} not installed
Snacks.notifier ~
- WARNING setup {disabled}
- ERROR is not ready
Snacks.quickfile ~
- WARNING setup {disabled}
Snacks.statuscolumn ~
- WARNING setup {disabled}
Snacks.terminal ~
- OK shell configured
- `vim.o.shell`: cmd.exe
- `parsed`: { "cmd.exe" }
Snacks.toggle ~
- WARNING {which-key} is not installed
Snacks.words ~
- WARNING setup {disabled}
Same issue here. My snacks.nvim config is here and, I used the latest :checkhealth snacks
below:
==============================================================================
snacks: require("snacks.health").check()
Snacks ~
- OK setup called
Snacks.bigfile ~
- OK setup {enabled}
Snacks.dashboard ~
- OK setup {enabled}
- OK setup ran
- WARNING dashboard did not open: `stdin is a pipe`
Snacks.lazygit ~
- OK {lazygit} installed
Snacks.notifier ~
- OK setup {enabled}
- OK is ready
Snacks.quickfile ~
- OK setup {enabled}
Snacks.statuscolumn ~
- OK setup {enabled}
Snacks.terminal ~
- OK shell configured
- `vim.o.shell`: /bin/zsh
- `parsed`: { "/bin/zsh" }
Snacks.toggle ~
- OK {which-key} is installed
Snacks.words ~
- OK setup {enabled}
Here's a better repro that's works properly, maybe that will help. It is the same result as my full repo. The :lua Snacks.dashboard() still works in this one.
vim.env.LAZY_STDPATH = ".repro"
load(vim.fn.system("curl -s https://raw.githubusercontent.com/folke/lazy.nvim/main/bootstrap.lua"))()
require("lazy.minit").repro({
spec = {
{
"folke/snacks.nvim",
priority = 1000,
lazy = false,
opts = {
dashboard = { enabled = true },
}
},
-- add any other plugins here
},
})
It gives me this for the healthcheck:
snacks: require("snacks.health").check()
Snacks ~
- OK setup called
Snacks.bigfile ~
- WARNING setup {disabled}
Snacks.dashboard ~
- OK setup {enabled}
- OK setup ran
- WARNING dashboard did not open: `stdin is a pipe`
Snacks.lazygit ~
- OK {lazygit} installed
Snacks.notifier ~
- WARNING setup {disabled}
- ERROR is not ready
Snacks.quickfile ~
- WARNING setup {disabled}
Snacks.statuscolumn ~
- WARNING setup {disabled}
Snacks.terminal ~
- OK shell configured
- `vim.o.shell`: cmd.exe
- `parsed`: { "cmd.exe" }
Snacks.toggle ~
- WARNING {which-key} is not installed
Snacks.words ~
- WARNING setup {disabled}
@ChrisGVE I just tried your dotfiles and it works perfectly fine on my laptop. I believe it might be something related to your OS, terminal or shell. I use Linux Mint, kitty and fish shell.
Ok, I thought I was being smart with checking for pipes, but it seems this doesn't work always for some reason....
What is your Neovim version?
Mine is:
NVIM v0.10.2
Build type: Release
LuaJIT 2.1.1727870382
Yep. With my dotfiles inside a Docker container (Ubuntu 24.04, same as my WSL2 distro), it works.
My dotfiles inside this Docker are a true copy of what I use outside Docker, and it works great here. You can try it here:
bash -c "$(curl -fsSL https://raw.githubusercontent.com/rachartier/dotfiles/main/.config/scripts/setup-container-env.sh)"
Version:
NVIM v0.11.0-dev-1172+gf164e1e35c
Build type: RelWithDebInfo
LuaJIT 2.1.1731601260
Ubuntu 24.04
Wezterm
tmux 3.5a
zsh 5.9 (x86_64-ubuntu-linux-gnu)
EDIT: no bob-nvim for me
Are you using bob-nvim by any chance?
Are you using bob-nvim by any chance?
no, homebrew installed nvim
Ah! Maybe it comes from nvim executed with the appimage? It seems like with nvim installed from apt, it works.
Did you check docs and existing issues?
Neovim version (nvim -v)
0.10.0
Operating system/version
Windows 10
Describe the bug
Dashboard, when enabled as in the example config does not show up on startup. It is only possible to access it with
:lua Snacks.dashboard()
and it shows up in a floating window.Steps To Reproduce
nvim
Expected Behavior
Dashboard needs to show up upon entry into nvim.
Repro