-
-
Notifications
You must be signed in to change notification settings - Fork 799
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/git previewer extensions #314
Feature/git previewer extensions #314
Conversation
This commit includes two groups of changes. First the previewer used for git commit and bcommit has been extended by two additional ones. While so far it was only showing the diff to the parent commit, it now also allows to show the diff to the current buffers state and showing the file as it was for this commit without any diff. As second change do all previewers now differ between the commit and bcommit scenario. For the commit case it shows the diff for all affected files, while the bcommit case only focuses on the current buffer alone. Note that the 'commit' - 'git_commit_as_was' case does not work too good. In fact equals the `commit' - 'git_commit_diff_to_parent', as this is how git show works. This should be tried to improved in future.
This adds a new action to checkout a git commit, but only for the current buffer. This allows easily to look back into the history of a file with 'bcommit' and get this version back to the current staging area.
This simply includes the eventually already staged changes. Since this is about history and not for planning the next commit, it makes sense to show the full diff.
@Conni2461 if you might wanna have a first look? Especially regarding the treatment of the relative path. I'm still thinking about ideas how to make the preview switchable. But if you already have something in mind.. |
First of all thanks for your contribution. I was about to go to bed so i will have a look at your code tomorrow.
I am not sure if i understand this correctly.
I have some ideas how we could make this possible but i let you take the shot. My tip would be take a look at |
Sure. The point is if all of these function always should be like I also thinking about improving the diff preview for |
Depends on if the user should be able to override or not. You could just do it and we can talk about it later, if tj or i think that could be improved. :)
I can feel you i am frustrated with the previewers too 馃ぃ. I think that is not possible with how |
Looks pretty good overall :) Good job |
Thanks for this pull request :).
The opts allows a certain amount of functional adaptations through having only 1 parameter and not a variable number. In your example it would certainly be easier to add another parameters but in terms of like hoisting, mocking, testing it can be easier to have a common interface in the function. I think the idea is opts can be foo()
foo({my_option = 'red'}) If the scope of calling them opts, and they are hard requirements makes them required, then it might make sense to prefix functions with the requirements. foo(value, opts)
foo('value', {})
foo('value', { my_option = 'red' }) In the case of the pickers, there are sane defaults can be applied and overwritten though optional arguments in the table. This allows composing through options.
Then you can do
And customize what opts get sent to the picker, or change the picker completely, or extend the current built in ones. Hopefully I cleared up the |
@rockerBOO thanks for this exhaustive explanation. This helps me to get better into the code base and follow the design approaches. I'm currently pretty busy at work with a lot of research in my free time etc. I'll continue to work on the feedback and start the preview cycling soonish. |
@weilbith Are you still working on this. Do you need any more assistance? You probably will have a bad time rebasing to current master with all the refactoring i did. I am very sorry about that. Also i will try out new git diff previewer ideas here #354. Those will not make your previewers obsolete. It just changes the underlining API from termopen to async plenary jobs and vim buffer as pager. That should fix some issues we currently have and give us more control. To even realize some of the stuff you were talking about. Feel free to ask any questions if you are not sure were we are heading and how you should proceed. |
Hey PS: I'm still watching the repository and saw your work (as you mentioned). I'm highly appreciating your contribution to a tool that helps me each day. :馃檹 |
Don't be sorry thats totally fine. Its almost christmas anyway, so we should just enjoy that this miserable year is almost over 馃ぃ . I just tried this new previewers idea, thought about this PR and was just checking in. I would recommend we just keep this current way of guiding, i don't wanna take away your PR and its not that urgent for me. My design approach would be to write a Edit: Also thanks for the kind works. We all just try to make it a better tool for ourselves. |
Hi, I'm just going through and checking on all the PRs. Do you need anything from me here? |
@weilbith I gonna pick this up in the next 2-3 days. It kinda want this to be done because its a really cool idea. :) I have not yet decided if i finish it in this PR or if i gonna open a new PR. Let me know if you still want to do it, then I will not do it :) |
Closing in favor of #528 |
Closes #307
This is my first attempt with the suggestion of @Conni2461 to just start with the new previewer functions. I extended this with some minor additional features. Still missing is the implementation of changing the previewer without restarting the picker. More detailed information in the commit messages.
I'm not too happy about the integration of the relative file path for the
bcommit
related preview cases. I'm open for better alternatives. E.g. I wasn't sure if the current design is meant to always only have theopts
as single parameter or if the pickers can simply pass additional parameters. 馃し