sponsor Vim development Vim logo Vim Book Ad

diffchar.vim : Highlight the exact differences, based on characters and words

 script karma  Rating 305/110, Downloaded by 11175  Comments, bugs, improvements  Vim wiki

created by
Rick Howe
script type
This plugin has been developed in order to make diff mode more useful. Vim highlights all the text in between the first and last different characters on a changed line. But this plugin will find the exact differences between them, character by character - so called DiffChar.

For example, in diff mode: ( [DiffText], <DiffAdd> )

    (window A) The [quick brown fox jumps over the lazy] dog.
    (window B) The [lazy fox jumps over the quick brown] dog.

this plugin will exactly show the changed and added units:

    (window A) The [quick] <brown >fox jumps over the [lazy] dog.
    (window B) The [lazy] fox jumps over the [quick] <brown >dog.

For details and demo samples, please visit the following git repository: https://github.com/rickhowe/diffchar.vim
install details
Install 'rickhowe/diffchar.vim' by using your plugin manager. Or manually unzip and copy all folders in your ~/.vim or ~/vimfiles.

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
diffchar8.91.zip 8.91 2021-12-07 8.0 Rick Howe Updated to check a new WinClosed event to appropriately reset/repair the highlighted diff units.
diffchar8.9.zip 8.9 2021-04-16 8.0 Rick Howe Fixed not to overrule syntax highlighting.
diffchar8.8.zip 8.8 2021-02-12 8.0 Rick Howe Changed to use appropriate highlighting groups in g:DiffColors and g:DiffPairVisible.
diffchar8.7.zip 8.7 2020-05-02 8.0 Rick Howe Enhanced g:DiffPairVisible option. Improved performance. Removed g:DiffMaxLines and g:DiffModeSync options.
diffchar8.6.zip 8.6 2019-08-29 8.0 Rick Howe Enhanced g:DiffPairVisible option to show a diff unit in a popup-window just below the cursor position.
diffchar8.5.zip 8.5 2019-03-23 8.0 Rick Howe Enhanced to show a balloon and display a corresponding diff unit. Fixed to correctly handle DiffChange lines while editing.
diffchar8.4.zip 8.4 2019-03-02 8.0 Rick Howe Extended g:DiffMaxLines to specify multiples of the window height. Reset all highlighted DiffChar units when more than two windows become diff mode in a tab page.
diffchar8.3.zip 8.3 2019-01-22 8.0 Rick Howe Fixed not to detect more DiffChange lines than g:DiffMaxLines option.
diffchar8.2.zip 8.2 2019-01-05 8.0 Rick Howe Fixed to correctly update the highlighted DiffChar units while editing  when a new internal diff (patch-8.1.360) is used.
diffchar8.1.zip 8.1 2018-11-18 8.0 Rick Howe Fixed to detect DiffChange lines even when all visible lines are in a closed fold.
diffchar8.0.zip 8.0 2018-11-01 8.0 Rick Howe Introduced a g:DiffMaxLines to be stable the performance independently of the file size. Enhanced to follow a new DiffUpdated event and iwhiteall/iwhiteeol of diffopt option, etc
diffchar7.6.zip 7.6 2018-07-22 7.0 Rick Howe Improved to make DiffChar highlights draw faster.
diffchar.vim 1.0 2014-05-02 7.0 Rick Howe Initial upload
ip used for rating:

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.