" diffchar.vim : Highlight the exact differences, based on characters and words " " ____ _ ____ ____ _____ _ _ _____ ____ " | | | || || || || | | || _ || _ | " | _ || || __|| __|| || | | || | | || | || " | | | || || |__ | |__ | __|| |_| || |_| || |_||_ " | |_| || || __|| __|| | | || || __ | " | || || | | | | |__ | _ || _ || | | | " |____| |_||_| |_| |_____||_| |_||_| |_||_| |_| " " Last Change: 2016/03/09 " Version: 6.1 " Author: Rick Howe if exists('g:loaded_diffchar') finish endif let g:loaded_diffchar = 6.1 let s:save_cpo = &cpo set cpo&vim " Commands command! -range SDChar call diffchar#ShowDiffChar(range(, )) command! -range RDChar call diffchar#ResetDiffChar(range(, )) command! -range TDChar call diffchar#ToggleDiffChar(range(, )) " Configurable Keymaps noremap ToggleDiffCharAllLines :%TDChar noremap ToggleDiffCharCurrentLine :TDChar nnoremap JumpDiffCharPrevStart \ :call diffchar#JumpDiffChar(0, 1) nnoremap JumpDiffCharNextStart \ :call diffchar#JumpDiffChar(1, 1) nnoremap JumpDiffCharPrevEnd \ :call diffchar#JumpDiffChar(0, 0) nnoremap JumpDiffCharNextEnd \ :call diffchar#JumpDiffChar(1, 0) if !hasmapto('ToggleDiffCharAllLines', 'nv') map ToggleDiffCharAllLines endif if !hasmapto('ToggleDiffCharCurrentLine', 'nv') map ToggleDiffCharCurrentLine endif if !hasmapto('JumpDiffCharPrevStart', 'n') nmap [b JumpDiffCharPrevStart endif if !hasmapto('JumpDiffCharNextStart', 'n') nmap ]b JumpDiffCharNextStart endif if !hasmapto('JumpDiffCharPrevEnd', 'n') nmap [e JumpDiffCharPrevEnd endif if !hasmapto('JumpDiffCharNextEnd', 'n') nmap ]e JumpDiffCharNextEnd endif " Set a difference unit type if !exists('g:DiffUnit') let g:DiffUnit = 'Word1' " \w\+ word and any \W single character " let g:DiffUnit = 'Word2' " non-space and space words " let g:DiffUnit = 'Word3' " \< or \> character class boundaries " let g:DiffUnit = 'Char' " any single character " let g:DiffUnit = 'CSV(,)' " split characters endif " Set a difference unit matching colors if !exists(':DiffColors') let g:DiffColors = 0 " always 1 color " let g:DiffColors = 1 " 4 colors in fixed order " let g:DiffColors = 2 " 8 colors in fixed order " let g:DiffColors = 3 " 16 colors in fixed order " let g:DiffColors = 100 " all available colors in dynamic random order endif " Set a difference unit updating while editing if !exists('g:DiffUpdate') let g:DiffUpdate = 1 " enable " let g:DiffUpdate = 0 " disable endif " Set a time length (ms) to apply this plugin's internal algorithm first if !exists('g:DiffSplitTime') let g:DiffSplitTime = 100 " when timeout, split to diff command " let g:DiffSplitTime = 0 " always apply diff command only endif " Set a diff mode synchronization to show/reset exact differences if !exists('g:DiffModeSync') let g:DiffModeSync = 1 " enable " let g:DiffModeSync = 0 " disable endif " Set this plugin's DiffCharExpr() to the diffexpr option if empty if !exists('g:DiffExpr') let g:DiffExpr = 1 " enable " let g:DiffExpr = 0 " disable endif if g:DiffExpr && empty(&diffexpr) let &diffexpr = 'diffchar#DiffCharExpr()' endif " Set an event group of this plugin augroup dchar au! au! FilterWritePre * call diffchar#SetDiffModeSync() augroup END let &cpo = s:save_cpo unlet s:save_cpo