sponsor Vim development Vim logo Vim Book Ad

linediff.vim : Perform an interactive diff on two blocks of text

 script karma  Rating 360/128, Downloaded by 3563  Comments, bugs, improvements  Vim wiki

created by
Andrew Radev
 
script type
utility
 
description
This plugin provides a simple command, ":Linediff", which is used to diff two separate blocks of text. Here's a simple example:

    def one
      two
    end

    def two
      three
    end

If we mark the first three lines, starting from "def one", in visual mode, and execute the ":Linediff" command, the signs "1-" will be placed at the start and at the end of the visual mode's range. Doing the same thing on the bottom half of the code, starting from "def two", will result in the signs "2-" placed there. After that, a new tab will be opened with the two blocks of code in vertical splits, diffed against each other.

The two buffers are temporary, but when any one of them is saved, its original buffer is updated. Note that this doesn't save the original buffer, just performs the change. Saving is something you should do later on yourself.

Executing the command ":LinediffReset" will delete the temporary buffers and remove the signs. Executing a new ":Linediff" will do the same as ":LinediffReset", but will also initiate a new diff process.

The code is hosted on github, at http://github.com/AndrewRadev/linediff.vim. To report any bugs, send patches or suggest features, please use github's issue tracker: http://github.com/AndrewRadev/linediff.vim/issues.
 
install details
The recommended way to install the plugin is by using Tim Pope's pathogen (http://www.vim.org/scripts/script.php?script_id=2332). In that case, you can clone the plugin's git repository like so:

    git clone git://github.com/AndrewRadev/linediff.vim.git ~/.vim/bundle/linediff

If your vim configuration is under git version control, you could also set up the repository as a submodule, which would allow you to update more easily. The command is (provided you're in ~/.vim):

    git submodule add git://github.com/AndrewRadev/linediff.vim.git bundle/linediff

Another method of installation is to simply copy all the essential directories inside the ~.vim/ directory: plugin, autoload, doc.
 

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
linediff.zip 0.2.0 2015-01-27 7.0 Andrew Radev Various bugfixes
linediff.zip 0.1.1 2011-11-07 7.0 Andrew Radev - Bugfix by xaizek (https://github.com/xaizek)
- Bugfix for statusline problem: https://github.com/AndrewRadev/linediff.vim/issues/2
linediff.zip 0.1.0 2011-09-14 7.0 Andrew Radev Initial upload
ip used for rating: 142.132.191.50

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.
   
Vim at Github