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

前端 未结 6 957
既然无缘
既然无缘 2020-12-13 00:10

Is it possible to diff or even vimdiff two very similar subroutines occurring in the same file? If so, how?

I can think of copying the two s

6条回答
  •  佛祖请我去吃肉
    2020-12-13 00:53

    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
    noremap \ldo :LinediffReset
    

提交回复
热议问题