How can I see moved lines in a file comparison with vimdiff / diff?
Moved lines are frequently annotated as deletes and adds but they can be shown as moved-from and moved-to instead.
Like in this screenshot of Notepad++.
vim diff vimdiff
bumped to the homepage by Community♦ 10 mins ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
add a comment |
Moved lines are frequently annotated as deletes and adds but they can be shown as moved-from and moved-to instead.
Like in this screenshot of Notepad++.
vim diff vimdiff
bumped to the homepage by Community♦ 10 mins ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
1
I don't get what you want. Can you maybe demonstrate this with a small example?
– Bernhard
Jun 28 '13 at 14:23
If you're looking for alternatives to vimdiff & diff just search this site, it's been pretty well covered already: unix.stackexchange.com/questions/tagged/diff
– slm♦
Jun 28 '13 at 15:30
@Bernhard I posted a screen shot of Notepad++ feature of diff'ing moved lines. I'm looking for a cli alternative, preferably in vim.
– 1.61803
Jun 28 '13 at 17:38
@slm, I want to diff moved lines preferably in vim.
– 1.61803
Jun 28 '13 at 17:40
Wikipedia has a (short) list of tools that can do this. I have only usedmeld
and it can't really detect moved lines (it kinda does) so take the list with a grain of salt.
– terdon♦
Jun 28 '13 at 18:29
add a comment |
Moved lines are frequently annotated as deletes and adds but they can be shown as moved-from and moved-to instead.
Like in this screenshot of Notepad++.
vim diff vimdiff
Moved lines are frequently annotated as deletes and adds but they can be shown as moved-from and moved-to instead.
Like in this screenshot of Notepad++.
vim diff vimdiff
vim diff vimdiff
edited Jun 28 '13 at 18:21
1.61803
asked Jun 28 '13 at 14:16
1.618031.61803
4761618
4761618
bumped to the homepage by Community♦ 10 mins ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
bumped to the homepage by Community♦ 10 mins ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
1
I don't get what you want. Can you maybe demonstrate this with a small example?
– Bernhard
Jun 28 '13 at 14:23
If you're looking for alternatives to vimdiff & diff just search this site, it's been pretty well covered already: unix.stackexchange.com/questions/tagged/diff
– slm♦
Jun 28 '13 at 15:30
@Bernhard I posted a screen shot of Notepad++ feature of diff'ing moved lines. I'm looking for a cli alternative, preferably in vim.
– 1.61803
Jun 28 '13 at 17:38
@slm, I want to diff moved lines preferably in vim.
– 1.61803
Jun 28 '13 at 17:40
Wikipedia has a (short) list of tools that can do this. I have only usedmeld
and it can't really detect moved lines (it kinda does) so take the list with a grain of salt.
– terdon♦
Jun 28 '13 at 18:29
add a comment |
1
I don't get what you want. Can you maybe demonstrate this with a small example?
– Bernhard
Jun 28 '13 at 14:23
If you're looking for alternatives to vimdiff & diff just search this site, it's been pretty well covered already: unix.stackexchange.com/questions/tagged/diff
– slm♦
Jun 28 '13 at 15:30
@Bernhard I posted a screen shot of Notepad++ feature of diff'ing moved lines. I'm looking for a cli alternative, preferably in vim.
– 1.61803
Jun 28 '13 at 17:38
@slm, I want to diff moved lines preferably in vim.
– 1.61803
Jun 28 '13 at 17:40
Wikipedia has a (short) list of tools that can do this. I have only usedmeld
and it can't really detect moved lines (it kinda does) so take the list with a grain of salt.
– terdon♦
Jun 28 '13 at 18:29
1
1
I don't get what you want. Can you maybe demonstrate this with a small example?
– Bernhard
Jun 28 '13 at 14:23
I don't get what you want. Can you maybe demonstrate this with a small example?
– Bernhard
Jun 28 '13 at 14:23
If you're looking for alternatives to vimdiff & diff just search this site, it's been pretty well covered already: unix.stackexchange.com/questions/tagged/diff
– slm♦
Jun 28 '13 at 15:30
If you're looking for alternatives to vimdiff & diff just search this site, it's been pretty well covered already: unix.stackexchange.com/questions/tagged/diff
– slm♦
Jun 28 '13 at 15:30
@Bernhard I posted a screen shot of Notepad++ feature of diff'ing moved lines. I'm looking for a cli alternative, preferably in vim.
– 1.61803
Jun 28 '13 at 17:38
@Bernhard I posted a screen shot of Notepad++ feature of diff'ing moved lines. I'm looking for a cli alternative, preferably in vim.
– 1.61803
Jun 28 '13 at 17:38
@slm, I want to diff moved lines preferably in vim.
– 1.61803
Jun 28 '13 at 17:40
@slm, I want to diff moved lines preferably in vim.
– 1.61803
Jun 28 '13 at 17:40
Wikipedia has a (short) list of tools that can do this. I have only used
meld
and it can't really detect moved lines (it kinda does) so take the list with a grain of salt.– terdon♦
Jun 28 '13 at 18:29
Wikipedia has a (short) list of tools that can do this. I have only used
meld
and it can't really detect moved lines (it kinda does) so take the list with a grain of salt.– terdon♦
Jun 28 '13 at 18:29
add a comment |
1 Answer
1
active
oldest
votes
For its diff view, Vim relies on the output of the diff
tool, which consists of line insertions (+
) and deletions (-
), but no moves. For convenience, Vim is able to highlight changes within a line, but it does not detect moves of (blocks of) lines, unlike Notepad++. You would need to implement this kind of feature yourself (e.g. using the sign column to show the moves).
could you please elaborate in detail on that implementation in order to mark your answer?
– 1.61803
Jun 28 '13 at 19:21
You would need to get the changes (either by querying the Vim buffers for the lines highlighted in theDiff...
highlight groups, or by running thediff
tool yourself again, write a clever algorithm to detect the moves, and then use:sign place
commands to attach the movement markers to the two diff buffers.
– Ingo Karkat
Jun 28 '13 at 19:40
Alternatively, you could patch the Vim source code itself; getting at the diff information would be easier than in Vimscript. Such a patch (maybe using different colors rather than signs) could even be accepted into mainline Vim!
– Ingo Karkat
Jun 28 '13 at 19:42
I rather hoped for a vimscript or a more feasible workaround. I leave it open for now.
– 1.61803
Jun 28 '13 at 23:47
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "106"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f81022%2fhow-can-i-see-moved-lines-in-a-file-comparison-with-vimdiff-diff%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
For its diff view, Vim relies on the output of the diff
tool, which consists of line insertions (+
) and deletions (-
), but no moves. For convenience, Vim is able to highlight changes within a line, but it does not detect moves of (blocks of) lines, unlike Notepad++. You would need to implement this kind of feature yourself (e.g. using the sign column to show the moves).
could you please elaborate in detail on that implementation in order to mark your answer?
– 1.61803
Jun 28 '13 at 19:21
You would need to get the changes (either by querying the Vim buffers for the lines highlighted in theDiff...
highlight groups, or by running thediff
tool yourself again, write a clever algorithm to detect the moves, and then use:sign place
commands to attach the movement markers to the two diff buffers.
– Ingo Karkat
Jun 28 '13 at 19:40
Alternatively, you could patch the Vim source code itself; getting at the diff information would be easier than in Vimscript. Such a patch (maybe using different colors rather than signs) could even be accepted into mainline Vim!
– Ingo Karkat
Jun 28 '13 at 19:42
I rather hoped for a vimscript or a more feasible workaround. I leave it open for now.
– 1.61803
Jun 28 '13 at 23:47
add a comment |
For its diff view, Vim relies on the output of the diff
tool, which consists of line insertions (+
) and deletions (-
), but no moves. For convenience, Vim is able to highlight changes within a line, but it does not detect moves of (blocks of) lines, unlike Notepad++. You would need to implement this kind of feature yourself (e.g. using the sign column to show the moves).
could you please elaborate in detail on that implementation in order to mark your answer?
– 1.61803
Jun 28 '13 at 19:21
You would need to get the changes (either by querying the Vim buffers for the lines highlighted in theDiff...
highlight groups, or by running thediff
tool yourself again, write a clever algorithm to detect the moves, and then use:sign place
commands to attach the movement markers to the two diff buffers.
– Ingo Karkat
Jun 28 '13 at 19:40
Alternatively, you could patch the Vim source code itself; getting at the diff information would be easier than in Vimscript. Such a patch (maybe using different colors rather than signs) could even be accepted into mainline Vim!
– Ingo Karkat
Jun 28 '13 at 19:42
I rather hoped for a vimscript or a more feasible workaround. I leave it open for now.
– 1.61803
Jun 28 '13 at 23:47
add a comment |
For its diff view, Vim relies on the output of the diff
tool, which consists of line insertions (+
) and deletions (-
), but no moves. For convenience, Vim is able to highlight changes within a line, but it does not detect moves of (blocks of) lines, unlike Notepad++. You would need to implement this kind of feature yourself (e.g. using the sign column to show the moves).
For its diff view, Vim relies on the output of the diff
tool, which consists of line insertions (+
) and deletions (-
), but no moves. For convenience, Vim is able to highlight changes within a line, but it does not detect moves of (blocks of) lines, unlike Notepad++. You would need to implement this kind of feature yourself (e.g. using the sign column to show the moves).
answered Jun 28 '13 at 18:56
Ingo KarkatIngo Karkat
8,73911932
8,73911932
could you please elaborate in detail on that implementation in order to mark your answer?
– 1.61803
Jun 28 '13 at 19:21
You would need to get the changes (either by querying the Vim buffers for the lines highlighted in theDiff...
highlight groups, or by running thediff
tool yourself again, write a clever algorithm to detect the moves, and then use:sign place
commands to attach the movement markers to the two diff buffers.
– Ingo Karkat
Jun 28 '13 at 19:40
Alternatively, you could patch the Vim source code itself; getting at the diff information would be easier than in Vimscript. Such a patch (maybe using different colors rather than signs) could even be accepted into mainline Vim!
– Ingo Karkat
Jun 28 '13 at 19:42
I rather hoped for a vimscript or a more feasible workaround. I leave it open for now.
– 1.61803
Jun 28 '13 at 23:47
add a comment |
could you please elaborate in detail on that implementation in order to mark your answer?
– 1.61803
Jun 28 '13 at 19:21
You would need to get the changes (either by querying the Vim buffers for the lines highlighted in theDiff...
highlight groups, or by running thediff
tool yourself again, write a clever algorithm to detect the moves, and then use:sign place
commands to attach the movement markers to the two diff buffers.
– Ingo Karkat
Jun 28 '13 at 19:40
Alternatively, you could patch the Vim source code itself; getting at the diff information would be easier than in Vimscript. Such a patch (maybe using different colors rather than signs) could even be accepted into mainline Vim!
– Ingo Karkat
Jun 28 '13 at 19:42
I rather hoped for a vimscript or a more feasible workaround. I leave it open for now.
– 1.61803
Jun 28 '13 at 23:47
could you please elaborate in detail on that implementation in order to mark your answer?
– 1.61803
Jun 28 '13 at 19:21
could you please elaborate in detail on that implementation in order to mark your answer?
– 1.61803
Jun 28 '13 at 19:21
You would need to get the changes (either by querying the Vim buffers for the lines highlighted in the
Diff...
highlight groups, or by running the diff
tool yourself again, write a clever algorithm to detect the moves, and then use :sign place
commands to attach the movement markers to the two diff buffers.– Ingo Karkat
Jun 28 '13 at 19:40
You would need to get the changes (either by querying the Vim buffers for the lines highlighted in the
Diff...
highlight groups, or by running the diff
tool yourself again, write a clever algorithm to detect the moves, and then use :sign place
commands to attach the movement markers to the two diff buffers.– Ingo Karkat
Jun 28 '13 at 19:40
Alternatively, you could patch the Vim source code itself; getting at the diff information would be easier than in Vimscript. Such a patch (maybe using different colors rather than signs) could even be accepted into mainline Vim!
– Ingo Karkat
Jun 28 '13 at 19:42
Alternatively, you could patch the Vim source code itself; getting at the diff information would be easier than in Vimscript. Such a patch (maybe using different colors rather than signs) could even be accepted into mainline Vim!
– Ingo Karkat
Jun 28 '13 at 19:42
I rather hoped for a vimscript or a more feasible workaround. I leave it open for now.
– 1.61803
Jun 28 '13 at 23:47
I rather hoped for a vimscript or a more feasible workaround. I leave it open for now.
– 1.61803
Jun 28 '13 at 23:47
add a comment |
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f81022%2fhow-can-i-see-moved-lines-in-a-file-comparison-with-vimdiff-diff%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
I don't get what you want. Can you maybe demonstrate this with a small example?
– Bernhard
Jun 28 '13 at 14:23
If you're looking for alternatives to vimdiff & diff just search this site, it's been pretty well covered already: unix.stackexchange.com/questions/tagged/diff
– slm♦
Jun 28 '13 at 15:30
@Bernhard I posted a screen shot of Notepad++ feature of diff'ing moved lines. I'm looking for a cli alternative, preferably in vim.
– 1.61803
Jun 28 '13 at 17:38
@slm, I want to diff moved lines preferably in vim.
– 1.61803
Jun 28 '13 at 17:40
Wikipedia has a (short) list of tools that can do this. I have only used
meld
and it can't really detect moved lines (it kinda does) so take the list with a grain of salt.– terdon♦
Jun 28 '13 at 18:29