Code Monkey home page Code Monkey logo

Comments (8)

gennaro-tedesco avatar gennaro-tedesco commented on September 28, 2024 1

I think just load up the last stored version for ease, as user probably assume that they'll have only one session to restore under a folder.

yes, I agree, this is probably the easiest and most common scenario, hence good for a first proof of concept. I will start working on it later in the day :)

say i open neo-tree and other buffers and save that session, this plugin will restore the neo-tree buffer also but it should not be stored with other buffers, instead neo-tree buffer should be closed and open when restore, check this setting:

I see. This seems to be specific to neo-tree and I would need a bit more time to dig into their code and check how they are implementing the autorestore of their buffers.

For the moment I will focus on auto-load in the current dir (as it is a general case that can be used by everybody) and then look into plugin-specific integrations, if possible.

from nvim-possession.

gennaro-tedesco avatar gennaro-tedesco commented on September 28, 2024 1

I have opened a PR where I somewhat managed to workaround the treesitter issue: it would be great if you could help me test if this is the intended behaviour you proposed (you may specify and install the corresponding branch with most package managers).

from nvim-possession.

gennaro-tedesco avatar gennaro-tedesco commented on September 28, 2024 1

The change has been merged on main with v0.0.2 and is available if you update the plugin via your plugin manager.

from nvim-possession.

gennaro-tedesco avatar gennaro-tedesco commented on September 28, 2024

Good morning and thank you for your suggestions!

i can't call neo-tree when restore session or this plugin does not aware of tree

Could you expand on what this behaviour is? I do not use neo-tree myself, so I do not know what is expected here.

and can you add auto restore base on current dir, so we don't have to load ourselves

Yes, this is planned, though I am still trying to understand what's the best way to implement it. Say for example there are 2-3 different sessions in the current dir, which one would you choose to autoload (or equivalently would you prompt the user all the times to choose, or would you just load up the first in the list)?

from nvim-possession.

tmpm697 avatar tmpm697 commented on September 28, 2024

Yes, this is planned, though I am still trying to understand what's the best way to implement it. Say for example there are 2-3 different sessions in the current dir, which one would you choose to autoload (or equivalently would you prompt the user all the times to choose, or would you just load up the first in the list)?

I think just load up the last stored version for ease, as user probably assume that they'll have only one session to restore under a folder.

Could you expand on what this behaviour is? I do not use neo-tree myself, so I do not know what is expected here.

say i open neo-tree and other buffers and save that session, this plugin will restore the neo-tree buffer also but it should not be stored with other buffers, instead neo-tree buffer should be closed and open when restore, check this setting:

  config = function()
    require("nvim-possession").setup({
      pre_save_cmds = { "Neotree action=close" },
      post_restore_cmds = { "Neotree action=show" },
    })
  end,

so above setting will instruct nvim-possession close neotree before save and then open it when restore --> this is correct way and what i wanted.

the above code won't work as it's not supported currently.

surprisingly this plugin work out-of-box with https://github.com/noib3/nvim-cokeline :thumbup:

from nvim-possession.

gennaro-tedesco avatar gennaro-tedesco commented on September 28, 2024

I have a work-in-progress branch where I started a caveman implementation for autoload: I am having troubles with treesitter syntax parsing though, it doesn't activate the highlight when buffers are automatically loaded and one must invoke it themselves - not sure why it is so.

If you want to try out the branch notice you must explicitly opt-in the autoload configuration, namely

possession.setup({
    autoload = true
})

from nvim-possession.

tmpm697 avatar tmpm697 commented on September 28, 2024

yes, it worked for me.

from nvim-possession.

tmpm697 avatar tmpm697 commented on September 28, 2024

for hooks pre_save_cmds, post_restore_cmds, you can check its implementation here: https://github.com/rmagatti/auto-session/blob/main/lua/auto-session.lua#L5
i don't understand it much :(

from nvim-possession.

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.