-
Notifications
You must be signed in to change notification settings - Fork 622
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’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support custom diff formatters (diff-so-fancy, delta etc) #542
Comments
just want to bump this! |
Is there a workaround for this? |
Any updates on this issue? Did somebody get it working? |
I'm curious about this too. I really like the clean view d-s-f gives. |
I just learned about |
diff-so-fancy support would be awesome! bump :) |
This would be awesome ! |
Oh i need this Feature ! |
I have looked into adding this support today. Unfortunately, I have not succeeded, and I currently think that I will take quite some effort to implement this support properly. The
It is the added coloring that makes this a hard task. As @jonas mentions in #313, The same could perhaps be done with At my current level of understanding of the situation I see these ways forward for this feature:
I have tried to make Instead of pursuing down this road, I would suggest attempting the second instead: Implementing native support inside Or does someone else have a different opinion/suggestion? |
Note that PR #901 is opened. It should solve items 3 and 4 of the list @andebjor mentions above. Items 1 and 2 should not be too difficult to implement in And then the current/default implementation of With that all done (note implementing item 1 and 2 is not even started and #901 is not merged yet) the mentioned features of |
@Liooo can you rename the issue to something like |
@ronjouch |
would be waiting for diff-so-fancy support |
+1 for formatters support |
+1 |
+1 for delta support |
+1 for delta support |
2 similar comments
+1 for delta support |
+1 for delta support |
Hi, I'm a contributor to delta, and I'm starting to implement delta support together with ANSI support in tig. As you can see in the image below, it is already close to completion. Don't care about commit message, I'll clean up after completion. As you can see, the color picking is working as well. (left below pane is the original delta output without parsing ANSI.) The problem is that ncurses needs to initialize color combinations in initialization, and I'm not sure how to implement the infinite number of RGB color combinations for delta. It may be going to take a lot of time this part, so if anyone has any ideas, please let me know. (I tried init_pair everytime but it won't work as expected of course. maybe we need to restrict users to use only one theme). discussion is here, I may going to limit options with delta by setting "true-color never". |
update: P.S. I have a question to people who want to use delta inside tig. Do you want turn off |
update: I think it is finished and I would like someone to test it because I've only tested it with iTerm on MacOS. I wrote how to setup in the PR above. |
You can put this setting in the tig configuration: Regarding |
Until tig can use more fancy differs (eg when git is configured to use delta), this will use `git diff` under the hood to achieve this a bit more cumbersomely. see jonas/tig#542
Anyone manage to build this on macOS yet? edit: nvm, managed to |
Might a workaround for now be to use the By adding the following lines to your
|
Amazing workaround, thanks a lot! I think I prefer using it with
Is there a way to open a windows and show this? Similar to the fzf-preview. Maybe a workaround with tmux. |
Is there a way to force |
This can be achieved by adding the following lines to
|
after get delta set up with git, I use tig + tmux to view diff, put the following mapping to .tigrc, move cursor to a commit hash in tig, then press '@' shortcut to open delta in a split tmux pane. this mapping handles the paging issue for a short diff output:
|
@oberprah Thanks! I prefer to set @linsong Great solution! I like the config it is inside tig instead of gitconfig. Maybe it is good idea to clarify in your comment that tig should run inside tmux in order to work. Btw, is there a way reuse the same tmux split? Let's say you return to the split where tig is running and press again Why is the Also, what if tig is not running inside tmux? Would a similar thing be possible with a mapping? |
Here also some examples using (floating in the middle of the screen)
(spliting in the bottom half)
Note: tig should be running inside tmux >3.3. Thanks @oberprah and @linsong. |
@pablospe welcome After googling and reading tmux man page for a while, I improve my previous binding a bit, it will reuse the same split tmux pane now: bind generic @ @sh -c "\
( \
tmux has-session -t '.{last}' \
&& tmux respawn-pane -t '.{last}' -k 'LESS= DELTA_PAGER=\"less -R\" git show %(commit)' \
) \
|| tmux split-window -l 80% 'LESS= DELTA_PAGER=\"less -R\" git show %(commit)'" Off course you can continue to improve this binding to check if running under tmux or not in the shell command, but I use tmux all the time, so I skip that part. |
This is the best solution so far, thanks! |
Similar to the tmux workaround, I’ve been using a kitty overlay via: bind generic d @kitten @ launch --self --type=overlay --title=current --cwd=current --env DELTA_PAGER='less -+F' git show %(commit) |
It'd be nice if tig supported diff-so-fancy, as previously mentioned in #313.
The text was updated successfully, but these errors were encountered: