Giter VIP home page Giter VIP logo

Comments (8)

olimorris avatar olimorris commented on August 22, 2024 3

@loqusion - really good suggestion! Much cleaner and will cover anyone's edge case. I've added this in the latest commit

from persisted.nvim.

olimorris avatar olimorris commented on August 22, 2024 2

I've marked this as an enhancement and will try and pick this up in a couple of weeks

from persisted.nvim.

loqusion avatar loqusion commented on August 22, 2024 1

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 SessionSaves, of course.

from persisted.nvim.

olimorris avatar olimorris commented on August 22, 2024

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.

okuuva avatar okuuva commented on August 22, 2024

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.

olimorris avatar olimorris commented on August 22, 2024

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.

okuuva avatar okuuva commented on August 22, 2024

That should do it, or at least I can't think of a reason why that wouldn't work.

from persisted.nvim.

okuuva avatar okuuva commented on August 22, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.