goolord / alpha-nvim Goto Github PK
View Code? Open in Web Editor NEWa lua powered greeter like vim-startify / dashboard-nvim
License: MIT License
a lua powered greeter like vim-startify / dashboard-nvim
License: MIT License
new layout element type pseudocode:
{
type = "lazy", placeholder = {"--", "--", "--"},
val = async function () return {type = "text", val = io()} end
}
Hi @goolord!
Great plugin; one odd thing I'm having an issue with..
In my zsh config, I use nvim for $MANPAGER
like so: export MANPAGER="$EDITOR +Man!"
(I have $EDITOR
assigned to use nvim
).
When i invoke man <term>
from a shell, it opens nvim, but stops at the alpha
"dashboard/startscreen"; is there some other option either for nvim or for alpha-nvim that I might need to set let it allow arguments to be passed in/called?
Adding an option to toggle will be helpful to set a keybind and go back and forth.
Similar to Startify, If you would call :Alpha if alpha is already open, then alpha would close.
Adding custom buttons to dashboard theme is slow for some keys.
So far, I've tried this with keys c and d. Both wait for like 1 second to execute command.
For Example :-
dashboard.button( "c", "open config" , ":e ~/.config/nvim/init.lua"),
But if I replace c with something like s, it executes instantly.
Error executing vim.schedule lua callback: ...e/nvim/site/pack/packer/start/nvim-cmp/lua/cmp/float.lua:94: Vim
(call):E5108: Error executing lua ...are/nvim/site/pack/packer/start/alpha-nvim/lua/alpha.lua:442: Cursor posi
tion outside buffer
If I open the file directly (e.g. nvim file
) I don't get any error. Only happens when opening files from startify e.g. MRU, bookmars, etc...
I did some testing and it seems like commit 923ea86 is where things break.
hey, a lua newbie here.
using the config example form the readme file:
use {
'goolord/alpha-nvim',
requires = { 'kyazdani42/nvim-web-devicons' },
config = function ()
require'alpha'.setup(require'alpha.themes.startify'.opts)
end
}
gives me:
E5113: Error while calling lua chunk: .config/nvim/lua/init.lua:122: attempt to call global 'use' (a nil value)
I want to migrate to this plugin so I can removed another viml dependence.
Right now of Startify I use various features https://github.com/mte90/dotfiles/blob/master/.vim/custom/custom-startify.vim
First of all I specify an ASCII custom text and center it.
I specify also the amount of files to see from recent files but also to show only Recent files and custom bookmarks.
Reading the documentation I didn't found anything about those settings.
Can you help me troubleshooting that?
Hi,
when I configure alpha to use startify theme:
use {
'goolord/alpha-nvim',
config = function()
require'alpha'.setup(require'alpha.themes.startify'.opts)
end
}
I get error on startup:
packer.nvim: Error running config for alpha-nvim: ...ck/packer/start/alpha-nvim/lua/alpha/themes/startify.lua:64: attempt to index a nil value
Any idea how to solve?
Thanks
Hi,
I tried install your nice plugin but right after startup I got:
E5108: Error executing lua ...are/nvim/site/pack/packer/start/alpha-nvim/lua/alpha.lua:82: attempt to call global 'from_nil' (a nil value)
Installed using packer:
use {
'goolord/alpha-nvim',
requires = {'kyazdani42/nvim-web-devicons'},
config = function()
require'alpha'.setup(require'alpha.themes.startify'.opts)
end
}
Thanks for fixing :)
After commit 658aff2, setting autocmd FileType alpha set showtabline=0 | autocmd BufUnload <buffer> set showtabline=2
won't work anymore (all autocmds are now disabled for the filetype alpha)
Doing this help getting the behavior back.
--- a/lua/alpha.lua
+++ b/lua/alpha.lua
@@ -385,7 +385,8 @@ local function enable_alpha(opts)
-- I don't have the patience to sort out a better way to do this
-- or seperate out the buffer local options.
vim.cmd([[
- noautocmd silent! setlocal bufhidden=wipe nobuflisted colorcolumn= foldlevel=999 foldcolumn=0 matchpairs= nocursorcolumn nocursorline nolist nonumber norelativenumber nospell noswapfile signcolumn=no synmaxcol& buftype=nofile filetype=alpha nowrap
+ silent! setlocal filetype=alpha
+ noautocmd silent! setlocal bufhidden=wipe nobuflisted colorcolumn= foldlevel=999 foldcolumn=0 matchpairs= nocursorcolumn nocursorline nolist nonumber norelativenumber nospell noswapfile signcolumn=no synmaxcol& buftype=nofile nowrap
augroup alpha_temp
au!
But if the commit was intended, is there a workaround (instead of touching the code like above)?
With startify there is possibility to add commands, session dir and bookmarks.
Is there any way to achieve such for alpha-nvim?
local handle = io.popen('fortune')
local fortune = handle:read("*a")
handle:close()
dashboard.section.footer.val = fortune
this adds like +25ms to the config time on my machine
25ms is not such a big deal, but it's mildly suspicious. if i can't figure out something faster to recommend, i should either remove the fortune example or mention its 'slowness' in the docs
In my setup I like to highlight trailing spaces in lines so I can easily remove them when I accidentally add, and this cause alpha to behave like the image bellow when there are lines with empty content (the light yellow ones).
I was wondering if its possible for the plugin to check if the current line being printed is empty and if so just break the line instead of adding the spaces to center it.
I am using the following config with alpha :
local alpha = require'alpha'
local dashboard = require'alpha.themes.dashboard'
dashboard.section.header.val = {
[[ __ ]],
[[ ___ ___ ___ __ __ /\_\ ___ ___ ]],
[[ / _ `\ / __`\ / __`\/\ \/\ \\/\ \ / __` __`\ ]],
[[/\ \/\ \/\ __//\ \_\ \ \ \_/ |\ \ \/\ \/\ \/\ \ ]],
[[\ \_\ \_\ \____\ \____/\ \___/ \ \_\ \_\ \_\ \_\]],
[[ \/_/\/_/\/____/\/___/ \/__/ \/_/\/_/\/_/\/_/]],
}
dashboard.section.buttons.val = {
dashboard.button( "e", " New file" , ":ene <BAR> startinsert <CR>"),
dashboard.button( "f", " > Find file", "<cmd>FzfLua files<CR>"),
dashboard.button( "r", " > Recent" , ":FzfLua oldfiles<CR>"),
dashboard.button( "s", " > Settings" , ":e $MYVIMRC | :FzfLua files cwd=~/.config/nvim<CR>"),
dashboard.button( "q", " Quit NVIM" , ":qa<CR>"),
}
local fortune = require("alpha.fortune")
dashboard.section.footer.val = fortune()
alpha.setup(dashboard.opts)
-- Disable folding on alpha buffer
vim.cmd([[
autocmd FileType alpha setlocal nofoldenable
]])
I am not able to use the options f
, r
and s
by pressing enter key on them. The fzf-lua
opens and closes immediately. I can open these choices by pressing f
, r
and s
keys respectively. Other choices can be selected with enter key. For s
choice, selecting with enter key on it opens init.vim but not fzf-lua window. Using s
key opens both.
Your function longest_line failed in uft8, I suggest create a function to count utf8 length similar to this
I know I can do this on my own, but vim-startify does this by default and it's a standard that a lot of other UI related plugins follow, where q
exits out (e.g nvim-tree, startify, neogit, etc ...)
This is my config for dashboard theme:
local alpha = require("alpha")
local dashboard = require("alpha.themes.dashboard")
-- Set header
dashboard.section.header.val = {
" ",
" ███╗ ██╗███████╗ ██████╗ ██╗ ██╗██╗███╗ ███╗ ",
" ████╗ ██║██╔════╝██╔═══██╗██║ ██║██║████╗ ████║ ",
" ██╔██╗ ██║█████╗ ██║ ██║██║ ██║██║██╔████╔██║ ",
" ██║╚██╗██║██╔══╝ ██║ ██║╚██╗ ██╔╝██║██║╚██╔╝██║ ",
" ██║ ╚████║███████╗╚██████╔╝ ╚████╔╝ ██║██║ ╚═╝ ██║ ",
" ╚═╝ ╚═══╝╚══════╝ ╚═════╝ ╚═══╝ ╚═╝╚═╝ ╚═╝ ",
" ",
}
-- Set menu
dashboard.section.buttons.val = {
dashboard.button( "Leader f f", " > Find file", ":Leaderf file --popup<CR>"),
dashboard.button( "Leader f r", " > Recent files" , ":Leaderf mru --popup<CR>"),
dashboard.button( "Leader f g", " > Project grep" , ":Leaderf rg --popup<CR>"),
dashboard.button( "e", " > New file" , ":enew <CR>"),
dashboard.button( "q", " > Quit NVIM", ":qa<CR>"),
}
local fortune = require("alpha.fortune")
dashboard.section.footer.val = fortune()
alpha.setup(dashboard.opts)
-- Send config to alpha
alpha.setup(dashboard.opts)
I observed that some fortune text get clipped and become incomplete, for example:
I am using neovim as my man pager using the following shell config:
if [[ "$(command -v nvim)" ]]; then
export EDITOR='nvim'
export MANPAGER='nvim +Man!'
export MANWIDTH=999
fi
without alpha nvim, it works well when I run man ls
. After using alpha-nvim, nvim opens, but the alpha-nvim start page is shown instead of the man page.
It's possible to alpha-stratify be aware of MRU files in the current branch?
I am trying to move over to this plugin from startify but having trouble getting sessions to work. This bit of the readme leads me to think sessions should show up somehow but I am not able to see them using either of the themes. Sorry if I missed something but just a bit confused 🙏
It would be great if this worked:
use {
'goolord/alpha-nvim',
requires = { 'kyazdani42/nvim-web-devicons' },
config = function ()
require'alpha'.setup {}
end
}
I would default to Startify, as it doesn't depend on specific plugins or keycaps and it just works out of the box.
The same issue here. Tags will be generated by plugin managers. There is no need to commit your tags file into remote repo, which will cause merging issues when git pull your remote reopo.
I want to generate a new dashboard colour at every vim start. I wrote this script but apparently the random_colours function generates the same colour everytime I start vim.
function random_colours(colours)
return colours[math.random(1, #colours)]
end
colours = {'cyan', 'red', 'yellow', 'orange', 'magenta', 'white', 'violet', 'lightyellow', 'seagreen', 'slateblue'}
vim.cmd(string.format('highlight dashboard guifg=%s guibg=bg', random_colours(colours)))
dashboard.section.header.opts.hl = 'dashboard'
The whole config is here:
vim.g.indentLine_fileTypeExclude = {'alpha'}
local alpha = require'alpha'
local dashboard = require'alpha.themes.dashboard'
dashboard.section.header.val = {
" ",
" ",
" ",
" ⣴⣶⣤⡤⠦⣤⣀⣤⠆ ⣈⣭⣿⣶⣿⣦⣼⣆ ",
" ⠉⠻⢿⣿⠿⣿⣿⣶⣦⠤⠄⡠⢾⣿⣿⡿⠋⠉⠉⠻⣿⣿⡛⣦ ",
" ⠈⢿⣿⣟⠦ ⣾⣿⣿⣷ ⠻⠿⢿⣿⣧⣄ ",
" ⣸⣿⣿⢧ ⢻⠻⣿⣿⣷⣄⣀⠄⠢⣀⡀⠈⠙⠿⠄ ",
" ⢠⣿⣿⣿⠈ ⣻⣿⣿⣿⣿⣿⣿⣿⣛⣳⣤⣀⣀ ",
" ⢠⣧⣶⣥⡤⢄ ⣸⣿⣿⠘ ⢀⣴⣿⣿⡿⠛⣿⣿⣧⠈⢿⠿⠟⠛⠻⠿⠄ ",
" ⣰⣿⣿⠛⠻⣿⣿⡦⢹⣿⣷ ⢊⣿⣿⡏ ⢸⣿⣿⡇ ⢀⣠⣄⣾⠄ ",
" ⣠⣿⠿⠛ ⢀⣿⣿⣷⠘⢿⣿⣦⡀ ⢸⢿⣿⣿⣄ ⣸⣿⣿⡇⣪⣿⡿⠿⣿⣷⡄ ",
" ⠙⠃ ⣼⣿⡟ ⠈⠻⣿⣿⣦⣌⡇⠻⣿⣿⣷⣿⣿⣿ ⣿⣿⡇ ⠛⠻⢷⣄ ",
" ⢻⣿⣿⣄ ⠈⠻⣿⣿⣿⣷⣿⣿⣿⣿⣿⡟ ⠫⢿⣿⡆ ",
" ⠻⣿⣿⣿⣿⣶⣶⣾⣿⣿⣿⣿⣿⣿⣿⣿⡟⢀⣀⣤⣾⡿⠃ ",
" ",
}
-- # TODO: get this shit working
-- random coloured dragon fuck yeah!!!
function random_colours(colours)
return colours[math.random(1, #colours)]
end
colours = {'cyan', 'red', 'yellow', 'orange', 'magenta', 'white', 'violet', 'lightyellow', 'seagreen', 'slateblue'}
vim.cmd(string.format('highlight dashboard guifg=%s guibg=bg', random_colours(colours)))
dashboard.section.header.opts.hl = 'dashboard'
dashboard.section.buttons.val = {
dashboard.button( "n", " New file", ":ene <BAR> startinsert <CR>"),
dashboard.button( "f", " Find File", ":Telescope find_files<CR>"),
dashboard.button( "r", " Recents", ":Telescope frecency<CR>"),
dashboard.button( "w", " Find Word", ":Telescope live_grep<CR>"),
dashboard.button( "b", " Bookmarks", ":Telescope marks<CR>"),
dashboard.button( "s", " Load Last Session", ":SessionLoad<CR>"),
dashboard.button( "q", " Quit NVIM", ":qa<CR>"),
}
local handle = io.popen('fortune')
local fortune = handle:read("*a")
handle:close()
dashboard.section.footer.val = fortune
alpha.setup(dashboard.opts)
Hi! I have a shell alias journal
that maps to nvim -c "WikiJournal"
(using wiki.vim). The issue: running journal
from shell takes me to my alpha start screen instead of to my journal in wiki.vim. From the alpha start screen, I can run:WikiJournal
without any issues, but passing in commands from shell doesn't seem to cooperate.
I'm synced with main, nvim v0.5.0.
Love the plugin! Happy to help fix, I just don't know where to start.
Right now I have something like this to have bookmarks to files:
startify.section.bottom_buttons.val = {
startify.button(
"c",
"~/.config/nvim/lua/config.lua",
":e ~/.config/nvim/lua/config.lua<CR>"
),
startify.button("i", "~/.config/nvim/init.lua", ":e ~/.config/nvim/init.lua<CR>"),
startify.button(
"P",
"~/.config/nvim/lua/modules/plugins/init.lua",
":e ~/.config/nvim/lua/modules/plugins/init.lua<CR>"
),
But, as you can see, it doesn't show up with icons.
This is just a nitpick and I'm happy with it not showing icons for those files, but I was wondering if it was possible to make it so I can create bookmarks to files and have it with icons.
Also, not related to this issue but how can I change and add titles ? I've looking through the docs and playing around with a few options but can't figure it out.
For example, I'd like to add "Bookmarks" above those files. and I'd like to change the MRU from this image:
To something else.
Hey, I updated the plugin today and it seems something broke.
I didn't change anything since installing it so it's likely something internal.
On nvim startup, I get this error
Usage:
require("alpha").setup(require("alpha.themes.startify").opts)
Let me know if i can provide any other info to help with debugging.
I've found a way to visibly reduce startup time with this plugin if setting local options is done with noautocmd
. So it would become noautocmd silent! setlocal ...
.
Here considerable speedup is achieved because setting filetype=alpha
might trigger a lot of FileType
autocommands. In order to have a way for others to run autocommand after 'alpha' buffer is opened, you can issue your custom event with doautocmd
(doautocmd User AlphaBuffer
).
Didn't make a PR because wasn't sure if it would affect anything else.
I am usingindent-blankline.nvim. And disable it when in the dashboard like this.
require("indent_blankline").setup { space_char_blankline = " ", show_current_context = true, context_patterns = { "def", "class", "return", "function", "method", "^if", "^while", "jsx_element", "^for" -- ... and you can add more }, buftype_exclude = {"terminal"}, filetype_exclude = {"dashboard"} }
Did I do anything wrong?
IDK if its a collision with other plugin key-binds but I can't open any file.
Its there any documentation part that I am missing?
my config:
local startify = require("alpha.themes.startify")
require("alpha").setup(startify.opts)
I use NVIM v0.6.0-dev+644-ge4976cbd2
Hi, would it be possible to implement image support? https://github.com/edluffy/hologram.nvim can help with displaying the images
Also recent used sessions or seeing 3 final files that has being used could be cool.
Is this possible with alpha?
Like
g.startify_custom_indices = {'a', 's', 'd', 'f', 'g', 'h', 'i'}
g.startify_bookmarks
g.startify_session_dir = '~/.config/nvim/session'
I've actually gotten attached to use dashboard view, but some tools from startify has being itching to get.
dashboard.nvim has the ability to cat files and put the output as a floating term on the dashboard screen
would be cool if we could have it here as well
it also allows for piping into lolcat etc
see: https://github.com/danielnehrig/nvim/blob/71d05338354edf3b8f1b8cc30fdec77ad74b5e60/lua/plugins/dashboard/init.lua
How to select multiple files like? In the vim-startify I can select the file pressing t
key.
This commit should consider the -u ${config_file}
case.
Currently it skips in that case though it should not.
Hi 😄
Awesome work with this plugin but how can change or customize the dashboard or the startify theme?
I didn't found this option in the readme or in the docs thanks for your help 👍🏼
In the code, you are already handling files as first argument.
It would be nice, if we could have an option to show the dashboard when the first argument a directory is.
Is there an option to ignore certain file or file types? Something akin to Startify's skiplist
Couldn't find anything in the docs
First of all, thank you very much for this awesome plugin!
I have been looking for something like mhinz/startify
but written in lua for some time now. This is great, the only thing that is preventing me to switch to it is that the bookmarks do not cd
into the directory of the file itself.
local startify = require("alpha.themes.startify")
-- disable MRU
startify.section.mru.val = { { type = "padding", val = 0 } }
-- disable MRU cwd
startify.section.mru_cwd.val = { { type = "padding", val = 0 } }
startify.section.top_buttons.val = {
-- I would like to cd into the directory first
startify.button("vi", "vim config", ":cd ~/Dotfiles/nvim/.config/nvim/<CR>:e init.lua<CR>"),
-- while also maintaining the format of the normal bookmark file button like this one:
startify.file_button("~/Dotfiles/nvim/.config/nvim/init.lua", "vit"),
}
startify.section.bottom_buttons.val = {
startify.button("q", "Quit Nvim", ":qa<CR>"),
startify.button("e", "New file", ":ene <BAR> startinsert <CR>"),
}
require("alpha").setup(startify.opts)
This is because I usually jump to the bookmark and then open Telescope
to reach files in the same directory. For example, when jumping to init.lua
generally I also want to see my plugins file or other nvim config files. With the current behavior of the plugin, when opening Telescope
or other file searching tree/finder, the directory is the one I opened nvim from and not the one where the file is located.
Is this possible with the available functionality ?
Make Alpha more approachable for theming by pulling out things like the header out to a common module that themes can use. alpha.themes.common
, for example.
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",
},
}
also when i add this part
local fortune = require "alpha.fortune"()
fortune = fortune:gsub("^%s+", ""):gsub("%s+$", "")
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
How to achieve a similar effect with dashboard theme like centered startify?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.