nvimdev / dashboard-nvim

vim dashboard
MIT License
2.37k stars 193 forks source link

New version of dashboard #139

Closed glepnir closed 2 years ago

glepnir commented 2 years ago

HI all. I had rewrite dashboard. I don't have much time to look issues that were created when I was hospitalized. if your problem still exist in new version, please create an issue let me know :)

Groctel commented 2 years ago

Hey! First of all: Glad to see you're doing fine :D

I've updated to the Lua version and the header is not centered. Appart from that, everything is doing fine. Here's a screenshot: image

This is my custom configuration:

local dashboard = require("dashboard")

local function repeat_str (str, times)
    return times > 0 and str..repeat_str(str, times-1) or ""
end

local empty_line = [[]]
local header = {
    empty_line,
    [[███╗   ██╗███████╗ ██████╗ ██╗   ██╗██╗███╗   ███╗]],
    [[████╗  ██║██╔════╝██╔═══██╗██║   ██║██║████╗ ████║]],
    [[██╔██╗ ██║█████╗  ██║   ██║██║   ██║██║██╔████╔██║]],
    [[██║╚██╗██║██╔══╝  ██║   ██║╚██╗ ██╔╝██║██║╚██╔╝██║]],
    [[██║ ╚████║███████╗╚██████╔╝ ╚████╔╝ ██║██║ ╚═╝ ██║]],
    [[╚═╝  ╚═══╝╚══════╝ ╚═════╝   ╚═══╝  ╚═╝╚═╝     ╚═╝]],
    empty_line
}

local splash = vim.fn.system("shuf -n 1 "..vim.fn.stdpath("config").."/splashes"):sub(1,-2).."!"
local padding = (#header[#header] - #splash) / 2 - 2
splash = repeat_str(" ", padding).."[ "..splash.." ]"

-- Add the splash string followed by two empty lines
table.insert(header, splash)
table.insert(header, empty_line)
table.insert(header, empty_line)
table.insert(header, empty_line)

dashboard.custom_header  = header
dashboard.custom_center = {
    {
        icon = "  ",
        desc = "New file                               ",
        shortcut = ":enew",
        action = "enew",
    },
    {
        icon = "  ",
        desc = "Find file                              ",
        shortcut = "SPC f",
        action = "Telescope find_files hidden=true no_ignore=true",
    },
    {
        icon = "  ",
        desc = "Browse dotfiles                        ",
        shortcut = "SPC v d",
        action = "Telescope find_files cwd=~/.config/nvim/ search_dirs=Ultisnips,lua,viml,init.vim",
    },
    {
        icon = "  ",
        desc = "Update plugins                         ",
        shortcut = ":PackerSync",
        action = "PackerSync",
    },
    {
        icon = "  ",
        desc = "Open floating terminal                 ",
        shortcut = "SPC t t",
        action = "FloatermToggle",
    },
    {
        icon = "  ",
        desc = "Close neovim                           ",
        shortcut = ":qa!",
        action = "qa!",
    },
}

The same alignment problem happens without the splash line or even without the custom header. I don't have time to look into it just now but if I pick it up before you I'll send a PR ;)

glepnir commented 2 years ago

first db.custom_header can a function that return a table. and you don't need to set padding ,just return a table like this

function custom_header()
local header = {
  '',
  '',
  '',
  ' ███╗   ██╗ ███████╗ ██████╗  ██╗   ██╗ ██╗ ███╗   ███╗',
  ' ████╗  ██║ ██╔════╝██╔═══██╗ ██║   ██║ ██║ ████╗ ████║',
  ' ██╔██╗ ██║ █████╗  ██║   ██║ ██║   ██║ ██║ ██╔████╔██║',
  ' ██║╚██╗██║ ██╔══╝  ██║   ██║ ╚██╗ ██╔╝ ██║ ██║╚██╔╝██║',
  ' ██║ ╚████║ ███████╗╚██████╔╝  ╚████╔╝  ██║ ██║ ╚═╝ ██║',
  ' ╚═╝  ╚═══╝ ╚══════╝ ╚═════╝    ╚═══╝   ╚═╝ ╚═╝     ╚═╝',
 '',
 '',
}

table.insert(header, your text here)
end

db.custom_header = custom_header
tin-pham commented 2 years ago

image I have the same issue, the header was not center

image

glepnir commented 2 years ago

fixed . image

marianpopeanga commented 2 years ago

This breaks anything people had in the configs. Not a very good choice !

glepnir commented 2 years ago

@marianpopeanga sorry for break your config. The new version is faster than old version which use vimscript write. and more customization. and i plan to add a new feature that support daily task in dashboard.

tin-pham commented 2 years ago

This breaks anything people had in the configs. Not a very good choice !

I think it easy to change, just look at example at the main page, also it cleaner in lua since the old version use vimscript

marianpopeanga commented 2 years ago

the issue is that there are entirely new commands. Everything was working just fine. You just don't break compatibility like this. You just wrap it around and keep everything working. If users need it or find useful they can use some variable to switch between these versions. Very basic stuff.

glepnir commented 2 years ago

The way to not break any configuration is to do compatible development, but I don't have a lot of time to do compatibility development in dashboard, because there are still many issues in lspsaga, galaxyline that need to be fixed. so I have a lot of work to do. sorry for this

ndom91 commented 2 years ago

So my vimscript version of glepnir/dashboard refused to update actually (which is a good thing! So it didn't just break out of no where). I had to explicitly remove it, and reinstall it to get the new lua version.

I was able to get everything back up and running how I had it within ~10min of reading through the README.md. Obviously not the greatest move completely changing it without a new branch or pkg name or whatever, but all-in-all was an easy transition to make. I like it! :tada:

halafi commented 2 years ago

For me the session management stopped working

E492: Not an editor command: SessionLoad

glepnir commented 2 years ago

@halafi yep there had remove session command. I found some session plugin that write in lua .so maybe them can do it better

avegancafe commented 2 years ago

Have you found a good alternative for session management @glepnir ? I was using this and am sad to see it go, though I understand the constraints. Could be nice to link to a replacement if you happen to have one!

glepnir commented 2 years ago

@keyboard-clacker https://github.com/Shatur/neovim-session-manager .I don't use this. but seems like good.

halafi commented 2 years ago

I was using vim-obsession before

max397574 commented 2 years ago

@marianpopeanga if this breaks your things just pin a commit

it's a good thing when something gets improved

great job glepnir

glepnir commented 2 years ago

session support .

genmzy commented 2 years ago

没想到突然回来了,注意身体要紧,太卷了确实容易伤身体

marianpopeanga commented 2 years ago

@max397574 Of course that i've pin that previous commit. This is broken for me. Things SHOULD get improved without braking things what work. All the previous commands should have been supported and not just screw things up.

avegancafe commented 2 years ago

@keyboard-clacker https://github.com/Shatur/neovim-session-manager .I don't use this. but seems like good.

Nice this one's solid @glepnir ! Just installed it and got it working and is a great replacement. Just had to turn off a few settings to get it to the same as you had implemented here, but can definitely exactly match behavior. Would you be open to adding a section in the README for this? I'm happy to open a PR for it if yeah

glepnir commented 2 years ago

I had readd the session support

sprainbrains commented 2 years ago

I have a problem with colorcheme after update. How to fix colors? I'm using gruvbox

image
glepnir commented 2 years ago

@sprainbrains you should check does your colorscheme have the dashboard highlightgroup. if not. you can highlight them in your config. like hi DashboardCenterIcon guifg= color code etc

sprainbrains commented 2 years ago

you should check does your colorscheme have the dashboard highlightgroup. if not. you can highlight them in your config. like hi DashboardCenterIcon guifg= color code etc

Oh... @glepnir Where can I see all the color Dashboard groups in order to make these changes? UPDATED: I found, sorry )

avegancafe commented 2 years ago

@sprainbrains all of the color groups are detailed on the main README now, I also ran into this and fixed by highlighting all of them. The current available groups are:

DashboardHeader DashboardCenter DashboardCenterIcon DashboardShortCut DashboardFooter

sgoudham commented 2 years ago

Hi, I've just upgraded but everything is still not centered as per the screenshot below:

image

My config is as follows:

local dashboard = require("dashboard")

dashboard.custom_header = {
        '                                                       ',
        '                                                       ',
        '                                                       ',
        ' ███╗   ██╗ ███████╗ ██████╗  ██╗   ██╗ ██╗ ███╗   ███╗',
        ' ████╗  ██║ ██╔════╝██╔═══██╗ ██║   ██║ ██║ ████╗ ████║',
        ' ██╔██╗ ██║ █████╗  ██║   ██║ ██║   ██║ ██║ ██╔████╔██║',
        ' ██║╚██╗██║ ██╔══╝  ██║   ██║ ╚██╗ ██╔╝ ██║ ██║╚██╔╝██║',
        ' ██║ ╚████║ ███████╗╚██████╔╝  ╚████╔╝  ██║ ██║ ╚═╝ ██║',
        ' ╚═╝  ╚═══╝ ╚══════╝ ╚═════╝    ╚═══╝   ╚═╝ ╚═╝     ╚═╝',
        '                                                       ',
        '                                                       ',
        '                                                       ',
        '                                                       ', 
}
dashboard.custom_center = {
    { 
        icon = '',
        desc = 'Load session                         ',
        shortcut = '<leader> l s',
    },
    { 
        icon = '',
        desc = 'Load Last Session                    ',
        shortcut = '<leader> s l',
    },
}

Am I missing some config to make it centred?

glepnir commented 2 years ago

@sgoudham your config works fine in my local

image

sgoudham commented 2 years ago

I am on Windows 11 so I wonder if that is making a difference?

I've tested in Windows Terminal and a graphical editor NeoVide which both result in the centering not working properly.

That's interesting that it works locally for others though. Problem is something with my config or tools 😅

glepnir commented 2 years ago

@sgoudham I don't use windows. but dashboard works fine in @Erven2016 his windows.

Erven2016 commented 2 years ago

@sgoudham It is normal on Windows 11, with your config. image

sgoudham commented 2 years ago

Huh that's interesting, I wonder what my problem is. Thanks for trying it out locally yourselves!

sgoudham commented 2 years ago

So it looks like it's an issue with neovide but I'm unsure what the problem is causing it not to be centred

nulldoot2k commented 2 years ago

image Help me, error packer.nvim by dashboard-nvim

glepnir commented 2 years ago

@CompanyDATV create a new issue for your problem

nulldoot2k commented 2 years ago

@CompanyDATV create a new issue for your problem

how bro :((

max397574 commented 2 years ago

new issue @CompanyDATV

experiacc commented 2 years ago

Ok I'm very confused but how are shortcuts supposed to work here? I have tried pressing space key + s + l (which is my leader key also) as well as only a single key (which i prefer).

But none of these seem to work

image

glepnir commented 2 years ago

it should work . if you use packer try PackerCompile. if not work .please create a new issue and fill issue template