swdev
swdev

Reputation: 5157

How to move to changed lines in Emacs using vc-diff?

In using vc-diff (I am using Subversion), is there any keystroke in emacs where we can move only to the changed lines quickly? It's quite unconvenience if we move to those lines using arrow key.

Thanks.

Upvotes: 3

Views: 412

Answers (3)

phils
phils

Reputation: 73274

Possibly the most important part of the C-hm documentation on the key bindings is this note:

When the buffer is read-only, the ESC prefix is not necessary.

Which description slightly obfuscates the fact that it is referring to keys using the Meta modifier.

Hence all of the following (by default in Emacs 26.1) can be used when the buffer is read-only (as it typically is when viewing a diff):

n             diff-hunk-next
p             diff-hunk-prev

TAB           diff-hunk-next
<backtab>     diff-hunk-prev

SPC           scroll-up-command
S-SPC         scroll-down-command
DEL           scroll-down-command

<             beginning-of-buffer
>             end-of-buffer

N             diff-file-next
P             diff-file-prev

}             diff-file-next
{             diff-file-prev

RET           diff-goto-source
o             diff-goto-source
<mouse-2>     diff-goto-source

k             diff-hunk-kill
K             diff-file-kill

0 .. 9        digit-argument
-             negative-argument

?             describe-mode
h             describe-mode

Upvotes: 0

h3dkandi
h3dkandi

Reputation: 1195

Use ? inside the diff window to get info for commands short keys and their usage.

Upvotes: 1

Nicholas Riley
Nicholas Riley

Reputation: 44321

There's diff-hunk-next (by default mapped to M-TAB) and a corresponding diff-hunk-prev. Looking at the mode documentation and keymap with C-h m is generally a good way to figure this kind of thing out; the commands are usually pretty logically named.

You might also investigate using ediff-revision instead of vc-diff (just hit RET three times to get it to default to comparing the same stuff as vc-diff would). I've got it mapped to C-x v e.

Upvotes: 5

Related Questions