How to open the dashboard conditionally #2117
Unanswered
rbhanot4739
asked this question in
Q&A
Replies: 2 comments 6 replies
-
Easyvim.schedule(function()
require('persistence').load()
end) Lazyvim.api.nvim_create_autocmd('User', {
pattern = 'SnacksDashboardOpened',
group = vim.api.nvim_create_augroup('smart_load', { clear = true }),
callback = function()
require('persistence').load()
vim.schedule(function()
pcall(vim.cmd.windo, 'edit')
end)
end,
}) |
Beta Was this translation helpful? Give feedback.
6 replies
-
Okay, so if you're using persisted.nvim, you can take a different approach. Simply autoload the session as shown in the README.md: {
'olimorris/persisted.nvim',
-- event = 'BufReadPre',
lazy = false,
opts = {
autoload = true,
should_save = function()
return vim.bo.filetype ~= 'snacks_dashboard'
end,
},
} If there’s no session, it will skip the initialization and open the dashboard. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I want to open the dashboard only if there are no sessions for the current directory; otherwise, I want to load the last session for the current directory.
I see
enabled
is a boolean, so is there a way to do so ?Beta Was this translation helpful? Give feedback.
All reactions