Shod
Shod

Reputation: 935

Vimdiff bring next diff at top or in the centre

While viewing diff of two files using vimdiff, when I do ]c to go to the next diff, the beginning of that next diff appears at the last line. Due to this, I have to scroll up few lines up to view the whole diff. Currently i do zt to take it to the top.

Is there any command / mapping that i can use to make the next diff appear at the top or at the centre?

Upvotes: 2

Views: 1241

Answers (1)

Wazam
Wazam

Reputation: 320

nnoremap ]c j]cztk

That seems to do the trick

It simply do the two commands you usually pair up. The k at the end goes up one line, because it seems that the zt goes up too far. And thus, the j is necessary so that vim actually goes to the next diff

Upvotes: 3

Related Questions