Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jumping between changed lines in VIM with fugitive

I have a huge file where I modified several lines, and saved it. The fugitive knows which lines are modified, and it would be very useful to just jump between them. Is there an existing hotkey for that, or can I map it somehow?

like image 226
Max Yankov Avatar asked Apr 24 '14 08:04

Max Yankov


2 Answers

If you mean you've done a :Gdiff to another revision or the index, you can use the built-in ]c and [c motions to jump to the next / previous start of a change, as Vim shows the changes in 'diff' mode.

Edit: Have a look at the gitgutter plugin; it shows the changes in the sign column, updates those automatically, and even overloads the mentioned ]c commands as you would like them to behave.

like image 121
Ingo Karkat Avatar answered Oct 21 '22 23:10

Ingo Karkat


Even without fugitive, vim maintains a changelist for every document which you can see by invoking :changes. You can jump through the changelist using g; (go to older change), g, (go to newer change).

like image 29
Dhruva Sagar Avatar answered Oct 21 '22 21:10

Dhruva Sagar