feat(builtin.git_diff): new picker for diff hunks #3131
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This PR adds a picker for git diff hunks. The new picker may seem similar to git_status picker at first. However, it allows to view multiple hunks in a single file as separate entries; when a hunk is selected it jumps the cursor to the changes line instead of a first line of a file. You can also supply additinal arguments such as
--ignore-all-space
which can make hunks seem even more granular and easier to review when navigating via telescope. I have been testing this picker in my configuration for the past few months and think that other telescope users will find this useful.I understand that at the time of first publishing this PR is in a pretty raw shape as it requires documentation updates and is currently using vim.fn.systemlist instead of an entry maker as entries cannot be inferred from a single line of output. I could not figure out a way to make the way the git diff output is parsed to work similar to how other pickers work. I if you think this is a welcome change I am happy to make appropriate changes to get this PR to a mergeable state.
Demo:
Screen.Recording.2024-05-22.at.01.36.07.mov
Look forward to see what you think about this feature.
Type of change
How Has This Been Tested?
:Teelscope git_diff
:Teelscope git_diff
Configuration:
Checklist: