folke / persistence.nvim

💾 Simple session management for Neovim
Apache License 2.0
655 stars 25 forks source link

Add a `session_available` method to check if session file exists #31

Closed fmbarina closed 3 months ago

fmbarina commented 1 year ago

Hi, just set up persistence.nvim and really liking it so far. I thought it'd be nice to add a quick "restore session" button on my dashboard, and conditionally only show that button when a session exists for the current working directory.

Unsure if I should've written a short example on the README/docs so users would find it easier.

EDIT: I'm so sorry, I just read #30 also adds this feature. I hadn't looked beyond the PR titles. Should I just close this one?

github-actions[bot] commented 3 months ago

This PR is stale because it has been open 60 days with no activity.

folke commented 3 months ago

You can just do vim.uv.fs_stat(require("persistence").get_current()). If nil there's no session