How to highlight lines changed since the last save of a file in Vim?

From Vim Wiki:

Type :changes to display lines where changes occurred.

Use g; and g, to jump to changed lines.


Straight from Vim documentation (see :help :DiffOrig):

if !exists(":DiffOrig")
    command DiffOrig vert new | set bt=nofile | r # | 0d_ | diffthis
          \ | wincmd p | diffthis
endif

Then just do :DiffOrig et voila!


if you're using CVS, Git or Subversion for your source files then this plugin script will do what you want: VIM svndiff

it probably wouldn't be too difficult to get it to work from a diff of a temp file instead (if it doesn't have that option already).

Tags:

Vim