Comments (4)
Yeah adding a config option is a good compromise. I can work on PR.
from persisted.nvim.
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.
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.
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)
- [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
- [Bug]: autoload as function is not called -- support should_autoload? HOT 1
- allowed_dirs and ignored_dirs not working HOT 4
- [Bug]: Sessions never auto load when passing path to nvim from commandline after recent updates HOT 1
- [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.