goolord / alpha-nvim

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

fix: only delete valid buffers on alpha close #248

Closed nicbytes closed 8 months ago

nicbytes commented 11 months ago

Hope you're all having a good day.

Encountered a problem when restoring sessions in AstroVim.

To see the problem:

  1. Install AstroVim
  2. Add the following to ~/.config/nvim/lua/user/plugins/user.lua:

    {
    "goolord/alpha-nvim",
    opts = function()
      local dashboard = require "alpha.themes.dashboard"
      require('alpha.term')
    
      dashboard.section.terminal.command = "cowsay I have herd you have a bug. Moo-tivating fix in progress."
      dashboard.section.terminal.width = 42
      dashboard.section.terminal.height = 16
      dashboard.section.terminal.opts.redraw = true
      dashboard.section.terminal.opts.window_config.zindex = 1
    
      dashboard.section.header.val = {
        "NeoVim",
      }
      dashboard.section.terminal.opts.hl = "DashboardHeader"
      dashboard.section.footer.opts.hl = "DashboardFooter"
    
      dashboard.config.layout = {
        { type = "padding", val = vim.fn.max { 2, vim.fn.floor(vim.fn.winheight(0) * 0.2) } },
        dashboard.section.terminal,
        { type = "padding", val = 2 },
        dashboard.section.header,
        { type = "padding", val = 3 },
        dashboard.section.buttons,
        { type = "padding", val = 3 },
        dashboard.section.footer,
      }
      dashboard.config.opts.noautocmd = true
      return dashboard
    end,
    },
  3. Use the <Space>Sl remap to load a previous session and observe the error.