Closed rj-jesus closed 5 months ago
You might find this issue helpful: https://github.com/jonas/tig/issues/1005
Essentially, use /^@@
to match a hunk, use n
for next match, N
for previous match,
gg` to go to top.
You can also use /^diff
for the start of an individual file in a larger diff.
I'm unsure if ydiff
has a way to bind these keybindings, however, but I would love to know if there is.
Found a solution!
Create a file called ~/.lesskey
with the contents:
#command e noaction /\^\@\@\r
Now, you will also want to set an env var:
export LESSKEY="~/.lesskey"
- If you are on macOS, you will need to replace your system-provided
less
with one built from source, usebrew install less
, and ensure that you have them both in yourPATH
:$ which less lesskey /opt/homebrew/bin/less /opt/homebrew/bin/lesskey
Do NOT use -k
to specify the lesskey file, do NOT name the file anything other than ~/.lesskey
.
You also do not need to use lesskey
to compile the ~/.lesskey
file to anything, do not touch the lesskey
command itself, you're just verifying it exists to ensure your less
version supports binding keys.
Now, run ydiff
, use e
to match a hunk, press n
for next match, N
for previous match.
Thanks for the tips @5HT2. Ydiff will not support the requests since the interaction is handled by the pager program (less
by default).
Hi,
Not an issue per se, but is there a way to navigate/move to the next hunk of diff? I sometimes work with very large diff files where only a few lines have changed, it would be extremely useful if I could navigate to those lines quickly. Any idea how this could be done?
Thanks very much!
-Ricardo