auto-session icon indicating copy to clipboard operation
auto-session copied to clipboard

[FEATURE] Add a hook for when no session is restored, like nvim .

Open FormalSnake opened this issue 1 year ago • 4 comments

Is your feature request related to a problem? Please describe. I use Alpha.nvim, and I never see it, so if the hook exists I could use Alpha.nvim or any other dashboard

Describe the solution you'd like A CMD hook like no_session_cmd

Describe alternatives you've considered None

Additional context image image

FormalSnake avatar Nov 16 '23 10:11 FormalSnake

also if anyone knows why there is a moon emoji pls tell me, that would be nice :P

FormalSnake avatar Nov 16 '23 10:11 FormalSnake

btw the screenshots I provided are the expected behaviour, I just simulated it.

FormalSnake avatar Nov 16 '23 14:11 FormalSnake

Interesting idea. What would you like to do as an example when no session is restored?

rmagatti avatar Nov 21 '23 06:11 rmagatti

Open the dashboard. I am sure there would be a lot of cool ideas but I can not come up with more.

FormalSnake avatar Nov 21 '23 06:11 FormalSnake

I ended up creating an alias v-="echo '' | nvim" to open the alpha, but it would be nice to also be able to drop into the dashboard if an error occurs.

BerkeleyTrue avatar Mar 11 '24 16:03 BerkeleyTrue

also if anyone knows why there is a moon emoji pls tell me, that would be nice :P

This is your shell prompt showing that you're in a directory containing Lua files.

boldandbrad avatar Jun 14 '24 14:06 boldandbrad

I've experienced this too when using Alpha.nvim. By design, on neovim startup auto-session restores and loads the buffer/etc from the last session if there is one, effectively skipping any user installed dashboard that would normally show on nvim startup.

This is definitely intended behavior. If you want to get "back" to the dashboard I'd recommend either deleting your session, or creating a keymap that allows you to pull the dashboard up whenever you like.

However, when a session ends with Alpha dashboard loaded, upon restore it does not properly render the dashboard, instead it renders an empty buffer. There might be room for improvement here.

boldandbrad avatar Jun 14 '24 14:06 boldandbrad

Added. Example setup

require("auto-session").setup {
  log_level = vim.log.levels.DEBUG,
  auto_session_suppress_dirs = { "~/", "~/Projects", "~/Downloads", "/" },
  auto_session_use_git_branch = false,
  no_restore_cmds = {
    function()
      vim.notify("!!!WASABI!!!", vim.log.levels.DEBUG)
    end
  }
}

rmagatti avatar Jun 27 '24 06:06 rmagatti