Skip to content
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

Provide keybindings to jump between differences #33

Open
hupfdule opened this issue Jun 28, 2022 · 4 comments
Open

Provide keybindings to jump between differences #33

hupfdule opened this issue Jun 28, 2022 · 4 comments

Comments

@hupfdule
Copy link

On longer lines (e.g. in logfiles) it may be hard to spot the differences even if they are highlighted.
It would therefore be nice to have some keybindings to jump to the next/prev difference, like ]d and [d.

@AndrewRadev
Copy link
Owner

When diffing areas, what's used its Vim's built-in "diff mode", and you could jump between changes with [c and ]c -- take a look at :help jumpto-diffs. You could remap them, although it might be tricky to do it just in diff mode. Does that work for you, or did you mean a different kind of jump?

@hupfdule
Copy link
Author

Thanks for the hint, but that was not exactly what I had in mind.

These movements are linewise movements. They jump to the next line that differs. But they don't jump the next difference inside the line. As linediff colors the actual differences in a line I was expecting that it would be possible to jump to the next such difference. But if only the internal vimdiff feature is used, maybe that is not possible.

@AndrewRadev
Copy link
Owner

AndrewRadev commented Jun 30, 2022

I see what you mean, yeah. Unfortunately, the plugin doesn't use anything special other than the built-in vimdiff. Theoretically, I could walk character by character to find the beginning of a syntax group, but that feels outside of the scope of the plugin. I did, however, find a few attempts at a general solution:

If you try some of these options out and they work well for your use cases, but they require some special command, I can add an option to the plugin to use it instead of the built-in diff.

@xaizek
Copy link
Contributor

xaizek commented Jul 9, 2022

I think since Vim does the diffing and has all the information about it, the best place to implement such mappings is in Vim itself. It will also make it work not just in this plugin. Please consider bringing it up in https://github.com/vim/vim/issues

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants