Giter VIP home page Giter VIP logo

Comments (4)

HumblePresent avatar HumblePresent commented on August 22, 2024 1

Yeah adding a config option is a good compromise. I can work on PR.

from persisted.nvim.

olimorris avatar olimorris commented on August 22, 2024

Couple of things regarding this.

Firstly, the plugin is only ever intended to be simple. I kinda broke my own rules by adding Telescope support but enough people were keen and I saw the benefits so included it. I did provisionally add branch and session details which could be picked up by the callbacks but dropped them as I couldn't implement them "simply".

Secondly, when Git Branching was implemented it was done in a pretty basic way. Append the branch name to the filename. That saved me storing state elsewhere. However it also means that it's pretty nasty when it comes to breaking changes or I'll need to come up with something that is no longer "simple" to solve it.

In theory, you have the session name so could determine the branch from that (although it's going to be super unreliable owing to how I implemented git branching).

So in summary, I built enough to make this simple and hoped that for users who want complexity, they can use the callbacks to achieve what they want.

from persisted.nvim.

HumblePresent avatar HumblePresent commented on August 22, 2024

I understand the desire for simplicity given this wouldn't be super simple to implement. Alternatively, would you consider using some known separator between the session directory name and the associated branch in the session file name? I am fine with implementing the branch switching in a callback but the issue is that I cannot reliably separate the branch name from the directory name based on the session file name. Here's an example session file

/home/name/.local/share/nvim/sessions/%home%dir_name_branch_name.vim

There is no way to know at what point within dir_name_branch_name the directory name ends and the branch name begins because the directory name and branch are just separated by an underscore. If they were separated by a unique separator like ++ or ## instead of the underscore then it could be easily parsed within a callback. This would technically be a breaking change but would only require a small code change.

from persisted.nvim.

olimorris avatar olimorris commented on August 22, 2024

So breaking changes are an absolute no-no for myself unless it's truly critical.

I wouldn't mind a config option that allows people to provide a separator option between session and branch. The default
could be _ but we could allow people to change it to ++ for instance. That way it doesn't break existing config yet would allow your ask above.

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.