Closed NextAlone closed 2 years ago
Haven't tried out your code yet but there's already been two PRs for this that I didn't accept (yet) because I want something very specific for it. https://github.com/PatrickF1/fzf.fish/pull/138
I want the preview to show both the staged and non-staged changes.
Haven't tried out your code yet but there's already been two PRs for this that I didn't accept (yet) because I want something very specific for it. #138
I want the preview to show both the staged and non-staged changes.
Just noticed that there were PRs here.
Don't let the fact the other two PRs didn't get merged discourage you. It was more because the authors lost interest than this feature being impossible to work on (I hope). If you can make the preview show both the staged and working directory diffs against HEAD, then I am happy to merge. Two potential solutions:
Don't let the fact the other two PRs didn't get merged discourage you. It was more because the authors lost interest than this feature being impossible to work on (I hope). If you can make the preview show both the staged and working directory diffs against HEAD, then I am happy to merge. Two potential solutions:
- run git diff and git diff —index separately and append them to a single file, then cat it https://stackoverflow.com/questions/67150991/show-both-worktree-and-index-changes-for-a-single-path-in-git
- use git status vv
Ok, i will check these two.
Don't let the fact the other two PRs didn't get merged discourage you. It was more because the authors lost interest than this feature being impossible to work on (I hope). If you can make the preview show both the staged and working directory diffs against HEAD, then I am happy to merge. Two potential solutions:
- run git diff and git diff —index separately and append them to a single file, then cat it https://stackoverflow.com/questions/67150991/show-both-worktree-and-index-changes-for-a-single-path-in-git
- use git status vv
Are you talking about being displayed together or separately?
How about this?
It preview untracked files/dirs as ordinary files/dirs, and diff new file with /dev/null, the others diff with HEAD.
if string match -r '\?\?' {1} > /dev/null
_fzf_preview_file {2..}
else if string match -r 'A' {1} > /dev/null
git diff --color=always -- /dev/null {2..}
else
git diff --color=always HEAD -- {2..}
end
Or split cached and uncached changes.
...
else
echo 'Unstaged'
git diff --color=always HEAD -- {2..}
echo -e '\nStaged'
git diff --color=always --cached HEAD -- {2..}
end
Are you talking about being displayed together or separately?
If there are both staged and working tree changes, I want the preview to show both.
Yeah the second one is along the lines of what I'm thinking. I guess you don't need the intermediate file to store them huh?
Are you talking about being displayed together or separately?
If there are both staged and working tree changes, I want the preview to show both.
Yeah the second one is along the lines of what I'm thinking. I guess you don't need the intermediate file to store them huh?
Yes, no intermediate file, and add check with status (just simply string match, don't know other convenient way)?
if string match -r '\?\?' {1} > /dev/null
_fzf_preview_file {2..}
else if string match -r 'A' {1} > /dev/null
git diff --color=always -- /dev/null {2..}
else
if string match -r '\S\s\S' > /dev/null
echo -e (set_color red)Unstaged
echo
git diff --color=always HEAD -- {2..}
echo
end
if string match -r '\s\s|\S\S\s' > /dev/null
echo (set_color green)Staged
echo
git diff --color=always --cached HEAD -- {2..}
end
end
X Y Meaning
-------------------------------------------------
[AMD] not updated
M [ MTD] updated in index
T [ MTD] type changed in index
A [ MTD] added to index
D deleted from index
R [ MTD] renamed in index
C [ MTD] copied in index
[MTARC] index and work tree matches
[ MTARC] M work tree changed since index
[ MTARC] T type changed in work tree since index
[ MTARC] D deleted in work tree
R renamed in work tree
C copied in work tree
-------------------------------------------------
D D unmerged, both deleted
A U unmerged, added by us
U D unmerged, deleted by them
U A unmerged, added by them
D U unmerged, deleted by us
A A unmerged, both added
U U unmerged, both modified
-------------------------------------------------
? ? untracked
! ! ignored
-------------------------------------------------
Not works with R(renamed), C(copied), T(type changed), and unmerged status. i will find out the way.
Are you talking about being displayed together or separately?
If there are both staged and working tree changes, I want the preview to show both. Yeah the second one is along the lines of what I'm thinking. I guess you don't need the intermediate file to store them huh?
Yes, no intermediate file, and add check with status (just simply string match, don't know other convenient way)?
if string match -r '\?\?' {1} > /dev/null _fzf_preview_file {2..} else if string match -r 'A' {1} > /dev/null git diff --color=always -- /dev/null {2..} else if string match -r '\S\s\S' > /dev/null echo -e (set_color red)Unstaged echo git diff --color=always HEAD -- {2..} echo end if string match -r '\s\s|\S\S\s' > /dev/null echo (set_color green)Staged echo git diff --color=always --cached HEAD -- {2..} end end
maybe this is enough to preview
No need to split ^A
, it works with staged file
Thanks for the updates. This week is really busy so it'll be a while before I can come back to review but just letting you know I won't forget about this
Thanks for the updates. This week is really busy so it'll be a while before I can come back to review but just letting you know I won't forget about this
It doesn't matter, I will always be here.
Thanks for the updates. This week is really busy so it'll be a while before I can come back to review but just letting you know I won't forget about this
It doesn't matter, I will always be here.
Don't worry I haven't forgotten about this, just thinking through what is the best way to make this feature simple and easy to use!
And if there any other changes request?
Nope, I'll take it from here and merge soon :)
Thanks for working on this and especially our patience @NextAlone! Really appreciate it. You are the third person to try to PR this change in and it seems third time's the charm. Sorry I've been so busy.
Thanks for working on this and especially our patience @NextAlone! Really appreciate it. You are the third person to try to PR this change in and it seems third time's the charm. Sorry I've been so busy.
Also thanks for your work, this is such a wonderful plugin.
Thanks for working on this and especially our patience @NextAlone! Really appreciate it. You are the third person to try to PR this change in and it seems third time's the charm. Sorry I've been so busy.
Also thanks for your work, this is such a wonderful plugin.
Thank you both! This is an excellent addition to an excellent plugin
@PatrickF1 And it is time to update Modified paths
section in Readme.
I did update it. I'll add a gif later. Or did you mean something else?
I did update it. I'll add a gif later. Or did you mean something else?
Just the gif,thanks for your work.
Add a preview for the changed file