sponsor Vim development Vim logo Vim Book Ad

perline-diff.vim : this line, that line, then diff comes up

 script karma  Rating 6/3, Downloaded by 1573  Comments, bugs, improvements  Vim wiki

created by
Rick Howe
 
script type
utility
 
description
You can see the differences between any lines displayed on the vim.

It is handy and simple. Press <F9> on a line in some window, and press <F9> again on another line in same or different window, then horizontally separated two tiny windows come up at the bottom of this page and shows those differences. Selected each lines are differently highlighted on their window. To return back to the original screen, just press <F10>.

You can select a block of lines by pressing <F9> in visual mode or by using SPLDiff command with range. If prefer to see those diff windows at top and/or in vertical, use g:PLDWLType global variable. <F9> and <F10> keys are configurable as well.

If diffchar.vim plugin has been installed, you can see the exact differences on both the perline diff windows.

Commands
:[range]SPLDiff - select lines and show those diff windows
:QPLDiff - quit the perline diff windows

Configurable keymaps
<Plug>ShowPerlineDiff (default: <F9>)
<Plug>QuitPerlineDiff (default: <F10>)

Global variables
g:PLDWLType - layout type of perline diff windows
    1 : bottom horizontal (default)
    2 : bottom vertical
    3 : top horizontal
    4 : top vertical

Update 1.2
* Fixed to restore the size of existing windows after closing perline diff windows.
* Fixed to show the exact difference with diffchar.vim 5.3 and later.

Update 1.1
* If an original window has been in diff mode, temporary clear its diff mode while displaying perline diff windows.
* If the selected lines are moved on the original window, their highlights will also follow those lines.
* Adjust height of perline diff windows to show just as many selected lines as possible including diff filler lines, within the half of vim's height.
 
install details
 

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
perline-diff.vim 1.2 2015-10-07 7.0 Rick Howe Restore the size of existing windows. Show the exact difference with diffchar.vim 5.3 and later.
perline-diff.vim 1.1 2015-02-05 7.0 Rick Howe Show as many selected and filler lines as possible. Show only the difference between selected lines by clearing diff mode on existing windows.
perline-diff.vim 1.0 2015-01-17 7.0 Rick Howe 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