How to ‘diff’ two subroutines in the same file in Vim?

Plugin linediff.vim : Perform an interactive diff on two blocks of text is similar to the one pointed ou by Vincent with some additional features:

  • has a command to close the opened buffer
  • seems to work without GUI
  • insert some visual indication on the original file(s) being diffed.

To use it you perform a visual selection on the first block to diff, enter command :Linediff, and repeat it to the second block. To quit, :LineDiffReset

I’ve found the followings maps helpful:

noremap \ldt :Linediff<CR>
noremap \ldo :LinediffReset<CR>

Leave a Comment