There isn't an easy way to sort the diff lines like so. Keep in mind that Vim does not know or care that the user lines are "sorted" nor is it immediately obvious to a diff algorithm how to do what you are showing because it's very dependent on the user intent. All Vim sees from the diff algorithm is "remove user2/user4 on the left, add user1/user3 on the right". Generally diff algorithms do not care about whether the contents are sorted or not.
Even if a feature is added to forcefully break the lines apart it would look like this rather than what you want (keep in mind that this feature does not exist and I simulated this by manually setting diff anchors):
Meanwhile if the inline highlight is distracting to you you can just turn off inline diff (set diffopt+=inline:none), which at least prevents Vim from doing the highlighting on the digits:
As I mentioned above, you can force Vim to show the diff however you want with diff anchors. It's not automatic though, as diff anchors are more designed to give you control over which lines to align where, when the algorithm does not do what you want. Say if you really want it to show up the way you want, with some manual fiddling to help visualize it, you can do it and get it to show up like this (see :help diff-anchors to see how to do this):
Diff anchor does have a bit of a learning curve especially if you need such granular controls, and it isn't a good fit if you want everything to be done automatically for you. FWIW the command I got to show the above is:
set diffopt+=anchorsetlocal diffanchors=1,2,2setlocal diffanchors=2,2,3
On Tue, Oct 28, 2025 at 5:37 AM Igor <igor2x@gmail.com> wrote:
Hi,1. I have two list of users like in file1:user1user3and in file2:user2user42. I open first file::e file12. Open second file:vsp file23. Do the diff between files:windo diffthisDiff is displayed as differences between files:
But I would like diff to be displayed as "line is missing" principle like this:Both list of users are sorted, so it should be visible which user is missing on which user list.How to force vim to display diff in "line missing" principle?Thanks--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/vim_use/ca29905e-da22-4bac-a8b2-ffe44ab4cb34n%40googlegroups.com.
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/vim_use/CAHTeOx_6-cuNR5oMpjS6bYnch-SHaoF8mMtYq0QMp7rT1oTY0A%40mail.gmail.com.
