Replies: 10 comments 13 replies
|
Shortly after posting this, I found the section about pagers in the docs, and this makes [ui]
pager = "delta"
[ui.diff]
format = "git"I'll leave this post up because I couldn't find how to configure delta before (and I searched through discussions). One problem that's left is with the above config, |
|
Loving It turns out that by default, To use jj’s default pager = ["delta", "--pager", "less -FRX"]I don’t love this either because when I look at a diff, I don’t usually want it to stick around. I only want this behavior when I’m looking at the log, and even then, I might not want it all the time. It turns out you can put the following in Then |
|
Thanks for that @david-crespo! It got me thinking about the newish [[--scope]]
--when.commands = ["diff"]
[--scope.ui]
# https://github.com/jj-vcs/jj/blob/v0.25.0/docs/config.md#processing-contents-to-be-paged
pager = "delta"
# NOTE: this is required when using `delta` as a pager
diff.format = "git"With this config, I was worried that this might break |
|
Has anyone been able to get 1: detect moved code and highlight differently than just add/delete |
|
Using @BoscoDomingo latest settings, works great. But I was thinking if I added: ...delta would use it's special merge conflict handling, but it doesn't seem to work. Any idea why? |
|
Got it working with: |
|
This PR #5257 fixes the warning The changelog describing the new option is here: https://jj-vcs.github.io/jj/latest/changelog/#0260-2025-02-05 I configured it using: [ui]
diff-formatter = "delta"
[merge-tools]
delta.diff-expected-exit-codes = [0, 1] |
|
The current setup that works for me:
# allow for `jj diff` and `jj show` to clear output from terminal after pager closed
[[--scope]]
--when.commands = ["diff", "show"]
[--scope.ui]
# stop using delta as the pager for already-delta-formatted output
pager = ["less", "-FR"] # seems to be default (?)
# keep delta as external diff formatter to diffs real temp files/dir and keep syntax highlighting
diff-formatter = "delta"
# pass jj's computed terminal width via $width
[merge-tools.delta]
diff-args = ["--width=$width", "$left", "$right"] |
|
My current setup is simply: [ui]
diff-formatter = "delta"
[merge-tools.delta]
diff-args = ["--side-by-side", "$left", "$right", "--width=$width"]
diff-expected-exit-codes = [0,1]
[aliases]
diffnav = ["diff", "--config=ui.diff-formatter=':git'", "--config=ui.pager='diffnav'"]That seems to support |
|
To whom it may concern, I was able to proompt out this based on @ansel1's solution, which only does side-by-side if the window is wide enough: [ui]
diff-formatter = "delta"
[merge-tools.delta]
program = "sh"
diff-args = ["-c", """
if [ "$3" -gt 200 ]; then
exec delta --side-by-side "$1" "$2" --width="$3"
else
exec delta --features=one-window "$1" "$2" --width="$3"
fi
""", "_", "$left", "$right", "$width"]
diff-expected-exit-codes = [0, 1]And here's the Nix home-manager version: programs.jujutsu = {
enable = true;
settings = {
ui.diff-formatter = "delta";
merge-tools.delta = {
program = "sh";
diff-args = [
"-c" # sh
''
if [ "$3" -gt 200 ]; then
exec delta --side-by-side "$1" "$2" --width="$3"
else
exec delta --features=one-window "$1" "$2" --width="$3"
fi
''
"_"
"$left"
"$right"
"$width"
];
# Fixes `tool exited with exit status: 1` warning
diff-expected-exit-codes = [ 0 1 ];
};
};
}; |
Uh oh!
There was an error while loading. Please reload this page.
I'm used to https://github.com/dandavison/delta for looking at diffs, and was wondering how to set it up with jj. I started with just setting the tool:
That results in this:
Note the very long left/right path. It can be improved like this:
What I haven't found is how to silence the warning at the end:
Has anyone figured out how? Any other tips?
All reactions