" spotdiff.vim : A range and area selectable diffthis to compare partially " " Last Change: 2024/06/23 " Version: 5.2 " Author: Rick Howe (Takumi Ohtani) " Copyright: (c) 2014-2024 by Rick Howe " License: MIT if exists('g:loaded_spotdiff') || !has('diff') || !exists('##WinClosed') finish endif let g:loaded_spotdiff = 5.2 let s:save_cpo = &cpoptions set cpo&vim command! -range -bar Diffthis call spotdiff#Diffthis(, ) command! -bang -bar Diffoff call spotdiff#Diffoff(0) command! -bar Diffupdate call spotdiff#Diffupdate() command! -range -bang -bar \ VDiffthis call spotdiff#VDiffthis(, , 0) command! -bang -bar VDiffoff call spotdiff#VDiffoff(0) command! -bar VDiffupdate call spotdiff#VDiffupdate() for [mod, key, plg, cmd] in [ \['v', 't', '(VDiffthis)', \':call spotdiff#VDiffthis(line("''<"), line("''>"), 0)'], \['v', 'T', '(VDiffthis!)', \':call spotdiff#VDiffthis(line("''<"), line("''>"), 1)'], \['n', 'o', '(VDiffoff)', \':call spotdiff#VDiffoff(0)'], \['n', 'O', '(VDiffoff!)', \':call spotdiff#VDiffoff(1)'], \['n', 'u', '(VDiffupdate)', \':call spotdiff#VDiffupdate()'], \['n', 't', '(VDiffthis)', \':let &operatorfunc = ''VDiffOpFunc0''g@'], \['n', 'T', '(VDiffthis!)', \':let &operatorfunc = ''VDiffOpFunc1''g@']] if !hasmapto(plg, mod) && empty(maparg(key, mod)) if get(g:, 'VDiffDoMapping', 1) call execute(mod . 'map ' . key . ' ' . plg) endif endif call execute(mod . 'noremap ' . plg . ' ' . cmd) endfor function! s:VDiffOpFunc0(vm) abort call spotdiff#VDiffOpFunc(a:vm, 0) endfunction function! s:VDiffOpFunc1(vm) abort call spotdiff#VDiffOpFunc(a:vm, 1) endfunction let &cpoptions = s:save_cpo unlet s:save_cpo " vim: ts=2 sw=0 sts=-1 et