Comments (8)
@loqusion - really good suggestion! Much cleaner and will cover anyone's edge case. I've added this in the latest commit
from persisted.nvim.
I've marked this as an enhancement and will try and pick this up in a couple of weeks
from persisted.nvim.
Another option is to use the return value of a callback (e.g. true
or false
) to determine whether a session should be auto-saved β that way, any condition can be implemented. We could either use the existing before_save
or introduce a new callback like should_save
or should_autosave
, or perhaps even allow the user to pass a callback to the existing autosave
as an alternative to a boolean. It shouldn't affect manual SessionSave
s, of course.
from persisted.nvim.
Are you lazy loading the plugin? I use this for my config:
use({
"olimorris/persisted.nvim",
module = "persisted", -- For lazy loading
config = function()
require("persisted").setup()
require("telescope").load_extension("persisted") -- To load the telescope extension
end,
})
and my "Find Session" command calls require("persisted").load()
.
I take your point though that there could be times when an empty session is saved to disk. Defo a risk if you don't lazy load.
from persisted.nvim.
Hmm, how would lazyloading work with autoloading sessions? My use case is that I want to load alpha dashboard if session autoload fails, my reasoning being that manually loading an existing session for the current workdir is an unnecessary extra step.
from persisted.nvim.
It wouldn't; misread that first part of the issue π. Really good use case btw.
I think there's two components we'd need:
- A global variable to inform other plugins (or your config) that no session has been autoloaded (a global variable feels like the cleanest way of doing this)
- The ability to ignore the
alpha
filetype, ensuring that a blank session is not saved to disk if you quit Neovim from the dashboard
Do you agree?
from persisted.nvim.
That should do it, or at least I can't think of a reason why that wouldn't work.
from persisted.nvim.
That's really nice, works like a charm and makes it easy to update if there's more conditions in the future! TakkΓ’ ennuv!
from persisted.nvim.
Related Issues (20)
- [Bug]: Getting "Could not find a session for" error on any new git repo or branch I open HOT 3
- [Bug]: Autoload not working HOT 3
- [Bug]: SessionLoad crashes HOT 12
- [Bug]: no-neck-pain.nvim `disable` doesn't work in `SavePre` hook HOT 9
- [Bug]: Session is not stored per git branch on windows HOT 8
- Replace callbacks with user events HOT 30
- Startup time increased dramatically HOT 3
- [Bug] The cmdheight reset to 1 after SessionLoad HOT 12
- [Bug]: Unable to turn off autosaving HOT 6
- `string.gsub(session, save_dir, "")` will fail if special characters are not escaped HOT 3
- [Bug]: sessions dir is empty and nothing opened when :SessionLoad HOT 3
- `autosave` should not fires when opening single file in any directory HOT 3
- [Bug]: SessionSave / SessionLoad not working HOT 8
- [Bug]: Session overwrite when switch via telescope? HOT 15
- [Bug]: Handle interaction with lazy.nvim HOT 1
- [Bug]: howto pin a buffer through sessions switching? HOT 1
- [Bug]: uv_close: Assertion `!uv__is_closing(handle' failed HOT 10
- [Bug]: Telescope extension doesn't work after neovim update HOT 4
- [Bug]: Autosave Not Triggered Without Existing Session File HOT 8
- [Bug]: Still running git commands when `use_git_branch=false` HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from persisted.nvim.