BlockDiff replaced by LineDiff
Update VisIncr git-svn-id: https://vimsuite.svn.sourceforge.net/svnroot/vimsuite/trunk@212 eb2d0018-73a3-4aeb-bfe9-1def61c9ec69
This commit is contained in:
parent
4eea06e04a
commit
ec0033810f
vimfiles
GetLatest
autoload
doc
plugin
@ -4,7 +4,7 @@ ScriptID SourceID Filename
|
|||||||
1009 3119 srec.vim (syntax file)
|
1009 3119 srec.vim (syntax file)
|
||||||
475 2535 latex-suite (install in vimfiles.latex)
|
475 2535 latex-suite (install in vimfiles.latex)
|
||||||
614 3666 C-Referenz
|
614 3666 C-Referenz
|
||||||
670 8073 visincr.vim (Visual Increment)
|
670 16281 visincr.vim (Visual Increment)
|
||||||
862 2635 cscope_quickfix.vim
|
862 2635 cscope_quickfix.vim
|
||||||
51 171 cscope_macros.vim
|
51 171 cscope_macros.vim
|
||||||
102 16171 DirDiff.vim
|
102 16171 DirDiff.vim
|
||||||
@ -19,7 +19,7 @@ ScriptID SourceID Filename
|
|||||||
1046 4249 Lusty Explorer
|
1046 4249 Lusty Explorer
|
||||||
2043 7805 VimPdb (debugging python)
|
2043 7805 VimPdb (debugging python)
|
||||||
1776 7902 Vimgrep Replace
|
1776 7902 Vimgrep Replace
|
||||||
2048 7817 BlockDiff
|
3745 16527 LineDiff
|
||||||
39 8196 matchit.vim
|
39 8196 matchit.vim
|
||||||
2092 8095 reloaded.vim (matrix colorscheme)
|
2092 8095 reloaded.vim (matrix colorscheme)
|
||||||
848 14668 SrchRplcHiGrp.vim (Search/Replace on Syntax Group)
|
848 14668 SrchRplcHiGrp.vim (Search/Replace on Syntax Group)
|
||||||
|
167
vimfiles/autoload/linediff/differ.vim
Normal file
167
vimfiles/autoload/linediff/differ.vim
Normal file
@ -0,0 +1,167 @@
|
|||||||
|
" Constructs a Differ object that is still unbound. To initialize the object
|
||||||
|
" with data, `Init(from, to)` needs to be invoked on that object.
|
||||||
|
function! linediff#differ#New(sign_name, sign_number)
|
||||||
|
let differ = {
|
||||||
|
\ 'original_buffer': -1,
|
||||||
|
\ 'diff_buffer': -1,
|
||||||
|
\ 'filetype': '',
|
||||||
|
\ 'from': -1,
|
||||||
|
\ 'to': -1,
|
||||||
|
\ 'sign_name': a:sign_name,
|
||||||
|
\ 'sign_number': a:sign_number,
|
||||||
|
\ 'sign_text': a:sign_number.'-',
|
||||||
|
\ 'is_blank': 1,
|
||||||
|
\ 'other_differ': {},
|
||||||
|
\
|
||||||
|
\ 'Init': function('linediff#differ#Init'),
|
||||||
|
\ 'IsBlank': function('linediff#differ#IsBlank'),
|
||||||
|
\ 'Reset': function('linediff#differ#Reset'),
|
||||||
|
\ 'Lines': function('linediff#differ#Lines'),
|
||||||
|
\ 'CreateDiffBuffer': function('linediff#differ#CreateDiffBuffer'),
|
||||||
|
\ 'SetupDiffBuffer': function('linediff#differ#SetupDiffBuffer'),
|
||||||
|
\ 'CloseDiffBuffer': function('linediff#differ#CloseDiffBuffer'),
|
||||||
|
\ 'UpdateOriginalBuffer': function('linediff#differ#UpdateOriginalBuffer'),
|
||||||
|
\ 'PossiblyUpdateOtherDiffer': function('linediff#differ#PossiblyUpdateOtherDiffer'),
|
||||||
|
\ 'SetupSigns': function('linediff#differ#SetupSigns')
|
||||||
|
\ }
|
||||||
|
|
||||||
|
exe "sign define ".differ.sign_name." text=".differ.sign_text." texthl=Search"
|
||||||
|
|
||||||
|
return differ
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Sets up the Differ with data from the argument list and from the current
|
||||||
|
" file.
|
||||||
|
function! linediff#differ#Init(from, to) dict
|
||||||
|
let self.original_buffer = bufnr('%')
|
||||||
|
let self.filetype = &filetype
|
||||||
|
let self.from = a:from
|
||||||
|
let self.to = a:to
|
||||||
|
|
||||||
|
call self.SetupSigns()
|
||||||
|
|
||||||
|
let self.is_blank = 0
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Returns true if the differ is blank, which means not initialized with data.
|
||||||
|
function! linediff#differ#IsBlank() dict
|
||||||
|
return self.is_blank
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Resets the differ to the blank state. Invoke `Init(from, to)` on it later to
|
||||||
|
" make it usable again.
|
||||||
|
function! linediff#differ#Reset() dict
|
||||||
|
call self.CloseDiffBuffer()
|
||||||
|
|
||||||
|
let self.original_buffer = -1
|
||||||
|
let self.diff_buffer = -1
|
||||||
|
let self.filetype = ''
|
||||||
|
let self.from = -1
|
||||||
|
let self.to = -1
|
||||||
|
let self.other_differ = {}
|
||||||
|
|
||||||
|
exe "sign unplace ".self.sign_number."1"
|
||||||
|
exe "sign unplace ".self.sign_number."2"
|
||||||
|
|
||||||
|
let self.is_blank = 1
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Extracts the relevant lines from the original buffer and returns them as a
|
||||||
|
" list.
|
||||||
|
function! linediff#differ#Lines() dict
|
||||||
|
return getbufline(self.original_buffer, self.from, self.to)
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Creates the buffer used for the diffing and connects it to this differ
|
||||||
|
" object.
|
||||||
|
function! linediff#differ#CreateDiffBuffer(edit_command) dict
|
||||||
|
let lines = self.Lines()
|
||||||
|
let temp_file = tempname()
|
||||||
|
|
||||||
|
exe a:edit_command . " " . temp_file
|
||||||
|
call append(0, lines)
|
||||||
|
normal! Gdd
|
||||||
|
set nomodified
|
||||||
|
|
||||||
|
let self.diff_buffer = bufnr('%')
|
||||||
|
call self.SetupDiffBuffer()
|
||||||
|
|
||||||
|
diffthis
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Sets up the temporary buffer's filetype and statusline.
|
||||||
|
"
|
||||||
|
" Attempts to leave the current statusline as it is, and simply add the
|
||||||
|
" relevant information in the place of the current filename. If that fails,
|
||||||
|
" replaces the whole statusline.
|
||||||
|
function! linediff#differ#SetupDiffBuffer() dict
|
||||||
|
let b:differ = self
|
||||||
|
|
||||||
|
let statusline = printf('[%s:%%{b:differ.from}-%%{b:differ.to}]', bufname(self.original_buffer))
|
||||||
|
if &statusline =~ '%f'
|
||||||
|
let statusline = substitute(&statusline, '%f', statusline, '')
|
||||||
|
endif
|
||||||
|
exe "setlocal statusline=" . escape(statusline, ' ')
|
||||||
|
exe "set filetype=" . self.filetype
|
||||||
|
setlocal bufhidden=hide
|
||||||
|
|
||||||
|
autocmd BufWrite <buffer> silent call b:differ.UpdateOriginalBuffer()
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! linediff#differ#CloseDiffBuffer() dict
|
||||||
|
exe "bdelete ".self.diff_buffer
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! linediff#differ#SetupSigns() dict
|
||||||
|
exe "sign unplace ".self.sign_number."1"
|
||||||
|
exe "sign unplace ".self.sign_number."2"
|
||||||
|
|
||||||
|
exe printf("sign place %d1 name=%s line=%d buffer=%d", self.sign_number, self.sign_name, self.from, self.original_buffer)
|
||||||
|
exe printf("sign place %d2 name=%s line=%d buffer=%d", self.sign_number, self.sign_name, self.to, self.original_buffer)
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Updates the original buffer after saving the temporary one. It might also
|
||||||
|
" update the other differ's data, provided a few conditions are met. See
|
||||||
|
" linediff#differ#PossiblyUpdateOtherDiffer() for details.
|
||||||
|
function! linediff#differ#UpdateOriginalBuffer() dict
|
||||||
|
let new_lines = getbufline('%', 0, '$')
|
||||||
|
|
||||||
|
" Switch to the original buffer, delete the relevant lines, add the new
|
||||||
|
" ones, switch back to the diff buffer.
|
||||||
|
call linediff#util#SwitchBuffer(self.original_buffer)
|
||||||
|
let saved_cursor = getpos('.')
|
||||||
|
call cursor(self.from, 1)
|
||||||
|
exe "normal! ".(self.to - self.from + 1)."dd"
|
||||||
|
call append(self.from - 1, new_lines)
|
||||||
|
call setpos('.', saved_cursor)
|
||||||
|
call linediff#util#SwitchBuffer(self.diff_buffer)
|
||||||
|
|
||||||
|
" Keep the difference in lines to know how to update the other differ if
|
||||||
|
" necessary.
|
||||||
|
let line_count = self.to - self.from + 1
|
||||||
|
let new_line_count = len(new_lines)
|
||||||
|
|
||||||
|
let self.to = self.from + len(new_lines) - 1
|
||||||
|
call self.SetupDiffBuffer()
|
||||||
|
call self.SetupSigns()
|
||||||
|
|
||||||
|
call self.PossiblyUpdateOtherDiffer(new_line_count - line_count)
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" If the other differ originates from the same buffer and it's located below
|
||||||
|
" this one, we need to update its starting and ending lines, since any change
|
||||||
|
" would result in a line shift.
|
||||||
|
"
|
||||||
|
" a:delta is the change in the number of lines.
|
||||||
|
function! linediff#differ#PossiblyUpdateOtherDiffer(delta) dict
|
||||||
|
let other = self.other_differ
|
||||||
|
|
||||||
|
if self.original_buffer == other.original_buffer
|
||||||
|
\ && self.to <= other.from
|
||||||
|
\ && a:delta != 0
|
||||||
|
let other.from = other.from + a:delta
|
||||||
|
let other.to = other.to + a:delta
|
||||||
|
|
||||||
|
call other.SetupSigns()
|
||||||
|
endif
|
||||||
|
endfunction
|
4
vimfiles/autoload/linediff/util.vim
Normal file
4
vimfiles/autoload/linediff/util.vim
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
" Helper method to change to a certain buffer.
|
||||||
|
function! linediff#util#SwitchBuffer(bufno)
|
||||||
|
exe "buffer ".a:bufno
|
||||||
|
endfunction
|
@ -1,7 +1,7 @@
|
|||||||
" visincr.vim: Visual-block incremented lists
|
" visincr.vim: Visual-block incremented lists
|
||||||
" Author: Charles E. Campbell, Jr. Ph.D.
|
" Author: Charles E. Campbell, Jr. Ph.D.
|
||||||
" Date: Dec 19, 2007
|
" Date: Aug 16, 2011
|
||||||
" Version: 19
|
" Version: 20
|
||||||
"
|
"
|
||||||
" Visincr assumes that a block of numbers selected by a
|
" Visincr assumes that a block of numbers selected by a
|
||||||
" ctrl-v (visual block) has been selected for incrementing.
|
" ctrl-v (visual block) has been selected for incrementing.
|
||||||
@ -25,8 +25,14 @@
|
|||||||
if &cp || exists("g:loaded_visincr")
|
if &cp || exists("g:loaded_visincr")
|
||||||
finish
|
finish
|
||||||
endif
|
endif
|
||||||
let s:keepcpo = &cpo
|
let g:loaded_visincr = "v20"
|
||||||
let g:loaded_visincr = "v19"
|
if v:version < 700
|
||||||
|
echohl WarningMsg
|
||||||
|
echo "***warning*** this version of visincr needs vim 7.0"
|
||||||
|
echohl Normal
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
let s:keepcpo= &cpo
|
||||||
set cpo&vim
|
set cpo&vim
|
||||||
|
|
||||||
" ---------------------------------------------------------------------
|
" ---------------------------------------------------------------------
|
||||||
@ -41,28 +47,32 @@ let s:IM = 6
|
|||||||
let s:IA = 7
|
let s:IA = 7
|
||||||
let s:IX = 8
|
let s:IX = 8
|
||||||
let s:IIX = 9
|
let s:IIX = 9
|
||||||
let s:IO = 10
|
let s:IB = 10
|
||||||
let s:IIO = 11
|
let s:IIB = 11
|
||||||
let s:IR = 12
|
let s:IO = 12
|
||||||
let s:IIR = 13
|
let s:IIO = 13
|
||||||
let s:IPOW = 14
|
let s:IR = 14
|
||||||
let s:IIPOW = 15
|
let s:IIR = 15
|
||||||
let s:RI = 16
|
let s:IPOW = 16
|
||||||
let s:RII = 17
|
let s:IIPOW = 17
|
||||||
let s:RIMDY = 18
|
let s:RI = 18
|
||||||
let s:RIYMD = 19
|
let s:RII = 19
|
||||||
let s:RIDMY = 20
|
let s:RIMDY = 20
|
||||||
let s:RID = 21
|
let s:RIYMD = 21
|
||||||
let s:RIM = 22
|
let s:RIDMY = 22
|
||||||
let s:RIA = 23
|
let s:RID = 23
|
||||||
let s:RIX = 24
|
let s:RIM = 24
|
||||||
let s:RIIX = 25
|
let s:RIA = 25
|
||||||
let s:RIO = 26
|
let s:RIX = 26
|
||||||
let s:RIIO = 27
|
let s:RIIX = 27
|
||||||
let s:RIR = 28
|
let s:RIB = 28
|
||||||
let s:RIIR = 29
|
let s:RIIB = 29
|
||||||
let s:RIPOW = 30
|
let s:RIO = 30
|
||||||
let s:RIIPOW = 31
|
let s:RIIO = 31
|
||||||
|
let s:RIR = 32
|
||||||
|
let s:RIIR = 33
|
||||||
|
let s:RIPOW = 34
|
||||||
|
let s:RIIPOW = 35
|
||||||
|
|
||||||
" ------------------------------------------------------------------------------
|
" ------------------------------------------------------------------------------
|
||||||
" Options: {{{1
|
" Options: {{{1
|
||||||
@ -104,8 +114,11 @@ fun! visincr#VisBlockIncr(method,...)
|
|||||||
" get increment (default=1; except for power increments, that's default=2) {{{3
|
" get increment (default=1; except for power increments, that's default=2) {{{3
|
||||||
if a:0 > 0
|
if a:0 > 0
|
||||||
let incr= a:1
|
let incr= a:1
|
||||||
|
" call Decho("incr<".incr.">")
|
||||||
if method == s:IX || method == s:IIX
|
if method == s:IX || method == s:IIX
|
||||||
let incr= s:Hex2Dec(incr)
|
let incr= s:Hex2Dec(incr)
|
||||||
|
elseif method == s:IB || method == s:IIB
|
||||||
|
let incr= s:Bin2Dec(incr)
|
||||||
elseif method == s:IO || method == s:IIO
|
elseif method == s:IO || method == s:IIO
|
||||||
let incr= s:Oct2Dec(incr)
|
let incr= s:Oct2Dec(incr)
|
||||||
endif
|
endif
|
||||||
@ -123,6 +136,9 @@ fun! visincr#VisBlockIncr(method,...)
|
|||||||
let leftcol = virtcol("'>")
|
let leftcol = virtcol("'>")
|
||||||
let rghtcol = virtcol("'<")
|
let rghtcol = virtcol("'<")
|
||||||
endif
|
endif
|
||||||
|
if &selection == "exclusive"
|
||||||
|
let rghtcol= rghtcol - 1
|
||||||
|
endif
|
||||||
let width= rghtcol - leftcol + 1
|
let width= rghtcol - leftcol + 1
|
||||||
" call Decho("width= [rghtcol=".rghtcol."]-[leftcol=".leftcol."]+1=".width)
|
" call Decho("width= [rghtcol=".rghtcol."]-[leftcol=".leftcol."]+1=".width)
|
||||||
|
|
||||||
@ -168,6 +184,25 @@ fun! visincr#VisBlockIncr(method,...)
|
|||||||
endif
|
endif
|
||||||
" call Decho(":IM restricted<".restrict.">")
|
" call Decho(":IM restricted<".restrict.">")
|
||||||
|
|
||||||
|
elseif a:method == s:RIB
|
||||||
|
let restrict= '\%'.col(".").'c[01]'
|
||||||
|
" call Decho(":IB restricted<".restrict.">")
|
||||||
|
elseif a:method == s:RIIB
|
||||||
|
let restrict= '\%'.col(".").'c\s\{,'.width.'}[01]'
|
||||||
|
" call Decho(":IIB restricted<".restrict.">")
|
||||||
|
elseif a:method == s:RIO
|
||||||
|
let restrict= '\%'.col(".").'c\o'
|
||||||
|
" call Decho(":IO restricted<".restrict.">")
|
||||||
|
elseif a:method == s:RIIO
|
||||||
|
let restrict= '\%'.col(".").'c\s\{,'.width.'}\o'
|
||||||
|
" call Decho(":IIB restricted<".restrict.">")
|
||||||
|
elseif a:method == s:RIX
|
||||||
|
let restrict= '\%'.col(".").'c\x'
|
||||||
|
" call Decho(":IX restricted<".restrict.">")
|
||||||
|
elseif a:method == s:RIIX
|
||||||
|
let restrict= '\%'.col(".").'c\s\{,'.width.'}\x'
|
||||||
|
" call Decho(":IIX restricted<".restrict.">")
|
||||||
|
|
||||||
elseif a:method == s:RIPOW
|
elseif a:method == s:RIPOW
|
||||||
let restrict= '\%'.col(".").'c\d'
|
let restrict= '\%'.col(".").'c\d'
|
||||||
" call Decho(":RIPOW restricted<".restrict.">")
|
" call Decho(":RIPOW restricted<".restrict.">")
|
||||||
@ -448,7 +483,7 @@ fun! visincr#VisBlockIncr(method,...)
|
|||||||
let l = y1
|
let l = y1
|
||||||
while l <= y2
|
while l <= y2
|
||||||
if exists("restrict") && getline(".") !~ restrict
|
if exists("restrict") && getline(".") !~ restrict
|
||||||
norm! j
|
silent! norm! j
|
||||||
let l= l + 1
|
let l= l + 1
|
||||||
continue
|
continue
|
||||||
endif
|
endif
|
||||||
@ -491,7 +526,7 @@ fun! visincr#VisBlockIncr(method,...)
|
|||||||
return
|
return
|
||||||
endif " IMDY IYMD IDMY ID IM
|
endif " IMDY IYMD IDMY ID IM
|
||||||
|
|
||||||
" I II IX IIX IO IIO IR IIR IPOW IIPOW: {{{3
|
" I II IX IIX IB IIB IO IIO IR IIR IPOW IIPOW: {{{3
|
||||||
" construct a line from the first line that only has the number in it
|
" construct a line from the first line that only has the number in it
|
||||||
let rml = rghtcol - leftcol
|
let rml = rghtcol - leftcol
|
||||||
let rmlp1 = rml + 1
|
let rmlp1 = rml + 1
|
||||||
@ -523,6 +558,8 @@ fun! visincr#VisBlockIncr(method,...)
|
|||||||
" call Decho("handle visblock not at far left")
|
" call Decho("handle visblock not at far left")
|
||||||
if method == s:IX || method == s:IIX
|
if method == s:IX || method == s:IIX
|
||||||
let pat = '^\(.\{-}\)\%'.leftcol.'v\([0-9a-fA-F \t]\{1,'.rmlp1.'}\).*$'
|
let pat = '^\(.\{-}\)\%'.leftcol.'v\([0-9a-fA-F \t]\{1,'.rmlp1.'}\).*$'
|
||||||
|
elseif method == s:IB || method == s:IIB
|
||||||
|
let pat = '^\(.\{-}\)\%'.leftcol.'v\([01 \t]\{1,'.rmlp1.'}\).*$'
|
||||||
elseif method == s:IO || method == s:IIO
|
elseif method == s:IO || method == s:IIO
|
||||||
let pat = '^\(.\{-}\)\%'.leftcol.'v\([0-7 \t]\{1,'.rmlp1.'}\).*$'
|
let pat = '^\(.\{-}\)\%'.leftcol.'v\([0-7 \t]\{1,'.rmlp1.'}\).*$'
|
||||||
elseif method == s:IR || method == s:IIR
|
elseif method == s:IR || method == s:IIR
|
||||||
@ -543,11 +580,13 @@ fun! visincr#VisBlockIncr(method,...)
|
|||||||
let cntlen = strlen(cnt)
|
let cntlen = strlen(cnt)
|
||||||
let cnt = substitute(cnt,'\s','',"ge")
|
let cnt = substitute(cnt,'\s','',"ge")
|
||||||
let ocnt = cnt
|
let ocnt = cnt
|
||||||
" call Decho("cntlen=".cntlen." cnt=".cnt." ocnt=".ocnt." (before I*[XOR] subs)")
|
" call Decho("cntlen=".cntlen." cnt=".cnt." ocnt=".ocnt." (before I*[BXOR] subs)")
|
||||||
|
|
||||||
" elide leading zeros
|
" elide leading zeros
|
||||||
if method == s:IX || method == s:IIX
|
if method == s:IX || method == s:IIX
|
||||||
let cnt= substitute(cnt,'^0*\([1-9a-fA-F]\|0$\)','\1',"ge")
|
let cnt= substitute(cnt,'^0*\([1-9a-fA-F]\|0$\)','\1',"ge")
|
||||||
|
elseif method == s:IB || method == s:IIB
|
||||||
|
let cnt= substitute(cnt,'^0*\(1\|0$\)','\1',"ge")
|
||||||
elseif method == s:IO || method == s:IIO
|
elseif method == s:IO || method == s:IIO
|
||||||
let cnt= substitute(cnt,'^0*\([1-7]\|0$\)','\1',"ge")
|
let cnt= substitute(cnt,'^0*\([1-7]\|0$\)','\1',"ge")
|
||||||
elseif method == s:IR || method == s:IIR
|
elseif method == s:IR || method == s:IIR
|
||||||
@ -569,6 +608,8 @@ fun! visincr#VisBlockIncr(method,...)
|
|||||||
" determine how much incrementing is needed {{{3
|
" determine how much incrementing is needed {{{3
|
||||||
if method == s:IX || method == s:IIX
|
if method == s:IX || method == s:IIX
|
||||||
let maxcnt= s:Dec2Hex(s:Hex2Dec(cnt) + incr*(y2 - y1))
|
let maxcnt= s:Dec2Hex(s:Hex2Dec(cnt) + incr*(y2 - y1))
|
||||||
|
elseif method == s:IB || method == s:IIB
|
||||||
|
let maxcnt= s:Dec2Bin(s:Bin2Dec(cnt) + incr*(y2 - y1))
|
||||||
elseif method == s:IO || method == s:IIO
|
elseif method == s:IO || method == s:IIO
|
||||||
let maxcnt= s:Dec2Oct(s:Oct2Dec(cnt) + incr*(y2 - y1))
|
let maxcnt= s:Dec2Oct(s:Oct2Dec(cnt) + incr*(y2 - y1))
|
||||||
elseif method == s:IR || method == s:IIR
|
elseif method == s:IR || method == s:IIR
|
||||||
@ -616,7 +657,7 @@ fun! visincr#VisBlockIncr(method,...)
|
|||||||
" call Decho("----- while [l=".l."] <= [y2=".y2."]: cnt=".cnt)
|
" call Decho("----- while [l=".l."] <= [y2=".y2."]: cnt=".cnt)
|
||||||
if exists("restrict") && getline(".") !~ restrict
|
if exists("restrict") && getline(".") !~ restrict
|
||||||
" call Decho("skipping <".getline(".")."> (restrict)")
|
" call Decho("skipping <".getline(".")."> (restrict)")
|
||||||
norm! j
|
silent! norm! j
|
||||||
let l= l + 1
|
let l= l + 1
|
||||||
continue
|
continue
|
||||||
endif
|
endif
|
||||||
@ -650,7 +691,7 @@ fun! visincr#VisBlockIncr(method,...)
|
|||||||
|
|
||||||
" back up to left-of-block (plus optional left-hand-side modeling) (left-justification support) {{{3
|
" back up to left-of-block (plus optional left-hand-side modeling) (left-justification support) {{{3
|
||||||
norm! 0
|
norm! 0
|
||||||
if method == s:I || method == s:IO || method == s:IX || method == s:IR || method == s:IPOW
|
if method == s:I || method == s:IB || method == s:IO || method == s:IX || method == s:IR || method == s:IPOW
|
||||||
let bkup= leftcol
|
let bkup= leftcol
|
||||||
" call Decho("bkup= [leftcol=".leftcol."] (due to method)")
|
" call Decho("bkup= [leftcol=".leftcol."] (due to method)")
|
||||||
elseif maxcntlen > 0
|
elseif maxcntlen > 0
|
||||||
@ -685,6 +726,8 @@ fun! visincr#VisBlockIncr(method,...)
|
|||||||
endif
|
endif
|
||||||
if method == s:IX || method == s:IIX
|
if method == s:IX || method == s:IIX
|
||||||
let cnt= s:Dec2Hex(s:Hex2Dec(cnt) + incr)
|
let cnt= s:Dec2Hex(s:Hex2Dec(cnt) + incr)
|
||||||
|
elseif method == s:IB || method == s:IIB
|
||||||
|
let cnt= s:Dec2Bin(s:Bin2Dec(cnt) + incr)
|
||||||
elseif method == s:IO || method == s:IIO
|
elseif method == s:IO || method == s:IIO
|
||||||
let cnt= s:Dec2Oct(s:Oct2Dec(cnt) + incr)
|
let cnt= s:Dec2Oct(s:Oct2Dec(cnt) + incr)
|
||||||
elseif method == s:IR || method == s:IIR
|
elseif method == s:IR || method == s:IIR
|
||||||
@ -834,6 +877,63 @@ fun! s:Dec2Oct(b10)
|
|||||||
return oct
|
return oct
|
||||||
endfun
|
endfun
|
||||||
|
|
||||||
|
" ------------------------------------------------------------------------------
|
||||||
|
" Bin2Dec: convert binary to decimal {{{2
|
||||||
|
fun! s:Bin2Dec(bin)
|
||||||
|
" call Dfunc("Bin2Dec(bin=".a:bin.")")
|
||||||
|
if a:bin >= 0
|
||||||
|
let n = a:bin
|
||||||
|
let neg= 0
|
||||||
|
else
|
||||||
|
let n = strpart(a:bin,1)
|
||||||
|
let neg = 1
|
||||||
|
endif
|
||||||
|
|
||||||
|
let b10 = 0
|
||||||
|
while n != ""
|
||||||
|
let bindigit= strpart(n,0,1)
|
||||||
|
if bindigit =~ '[01]'
|
||||||
|
let bindigit= char2nr(bindigit) - char2nr('0')
|
||||||
|
" call Decho("bindigit=".bindigit)
|
||||||
|
else
|
||||||
|
break
|
||||||
|
endif
|
||||||
|
let b10= 2*b10 + bindigit
|
||||||
|
let n = strpart(n,1)
|
||||||
|
endwhile
|
||||||
|
|
||||||
|
if neg
|
||||||
|
let b10= -b10
|
||||||
|
endif
|
||||||
|
" call Dret("Bin2Dec ".b10)
|
||||||
|
return b10
|
||||||
|
endfun
|
||||||
|
|
||||||
|
" ---------------------------------------------------------------------
|
||||||
|
" Dec2Bin: convert decimal to binary {{{2
|
||||||
|
fun! s:Dec2Bin(b10)
|
||||||
|
" call Dfunc("Dec2Bin(b10=".a:b10.")")
|
||||||
|
if a:b10 >= 0
|
||||||
|
let b10 = a:b10
|
||||||
|
let neg = 0
|
||||||
|
else
|
||||||
|
let b10 = -a:b10
|
||||||
|
let neg = 1
|
||||||
|
endif
|
||||||
|
|
||||||
|
let bin = ""
|
||||||
|
while b10
|
||||||
|
let bin = '01'[b10 % 2] . bin
|
||||||
|
let b10 = b10 / 2
|
||||||
|
endwhile
|
||||||
|
|
||||||
|
if neg
|
||||||
|
let bin= "-".bin
|
||||||
|
endif
|
||||||
|
" call Dret("Dec2Bin ".bin)
|
||||||
|
return bin
|
||||||
|
endfun
|
||||||
|
|
||||||
" ------------------------------------------------------------------------------
|
" ------------------------------------------------------------------------------
|
||||||
" Roman Numeral Support: {{{2
|
" Roman Numeral Support: {{{2
|
||||||
let s:d2r= [ [ 1000000 , 'M)' ],[900000 , 'CM)' ], [500000 , 'D)' ], [400000 , 'CD)' ], [100000 , 'C)' ], [90000 , 'XC)' ], [50000 , 'L)' ], [40000 , 'XL)' ], [10000 , 'X)' ], [9000 , 'IX)'], [5000 , 'V)'], [1000 , 'M' ], [900 , 'CM'], [500 , 'D'], [400 , 'CD'], [100 , 'C'], [90 , 'XC'], [50 , 'L'], [40 , 'XL'], [10 , 'X'], [9 , 'IX'], [5 , 'V'], [4 , 'IV'], [1 , 'I'] ]
|
let s:d2r= [ [ 1000000 , 'M)' ],[900000 , 'CM)' ], [500000 , 'D)' ], [400000 , 'CD)' ], [100000 , 'C)' ], [90000 , 'XC)' ], [50000 , 'L)' ], [40000 , 'XL)' ], [10000 , 'X)' ], [9000 , 'IX)'], [5000 , 'V)'], [1000 , 'M' ], [900 , 'CM'], [500 , 'D'], [400 , 'CD'], [100 , 'C'], [90 , 'XC'], [50 , 'L'], [40 , 'XL'], [10 , 'X'], [9 , 'IX'], [5 , 'V'], [4 , 'IV'], [1 , 'I'] ]
|
||||||
|
124
vimfiles/doc/linediff.txt
Normal file
124
vimfiles/doc/linediff.txt
Normal file
@ -0,0 +1,124 @@
|
|||||||
|
==============================================================================
|
||||||
|
CONTENTS *linediff* *linediff-contents*
|
||||||
|
|
||||||
|
Installation...........................: |linediff-installation|
|
||||||
|
Usage..................................: |linediff-usage|
|
||||||
|
Commands...............................: |linediff-commands|
|
||||||
|
Internals..............................: |linediff-internals|
|
||||||
|
Issues.................................: |linediff-issues|
|
||||||
|
|
||||||
|
|
||||||
|
==============================================================================
|
||||||
|
INSTALLATION *linediff-installation*
|
||||||
|
|
||||||
|
There are several ways to install the plugin. The recommended one 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 way is to simply copy all the essential directories inside the ~.vim/
|
||||||
|
directory: plugin, autoload, doc.
|
||||||
|
|
||||||
|
==============================================================================
|
||||||
|
USAGE *linediff-usage*
|
||||||
|
|
||||||
|
The plugin provides a simple command, |:Linediff|, which is used to diff two
|
||||||
|
separate blocks of text.
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
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 statuslines of the two temporary buffers will be changed to contain:
|
||||||
|
- The original buffer
|
||||||
|
- The starting line of the selected segment
|
||||||
|
- The ending line of the selected segment
|
||||||
|
|
||||||
|
If you're using a custom statusline and it contains "%f" (the current file's
|
||||||
|
name), that token will simply be substituted by the above data. Otherwise, the
|
||||||
|
entire statusline will be set to a custom one.
|
||||||
|
|
||||||
|
==============================================================================
|
||||||
|
COMMANDS *linediff-commands*
|
||||||
|
|
||||||
|
*:Linediff*
|
||||||
|
:Linediff The main interface of the plugin. Needs to be executed on a
|
||||||
|
range of lines, which will be marked with a sign. On the
|
||||||
|
selection of the second such range, the command will open a
|
||||||
|
tab with the two ranges in vertically split windows and
|
||||||
|
perform a diff on them. Saving one of the two buffers will
|
||||||
|
automatically update the original buffer the text was taken
|
||||||
|
from.
|
||||||
|
|
||||||
|
When executed for a third time, a new line diff is
|
||||||
|
initiated, and the current process is reset, much like the
|
||||||
|
effect of |LinediffReset| would be.
|
||||||
|
|
||||||
|
|
||||||
|
*:LinediffReset*
|
||||||
|
:LinediffReset Removes the signs denoting the diffed regions and deletes
|
||||||
|
the temporary buffers, used for the diff. The original
|
||||||
|
buffers are untouched by this, which means that any updates
|
||||||
|
to them, performed by the diff process will remain.
|
||||||
|
|
||||||
|
==============================================================================
|
||||||
|
INTERNALS *linediff-internals*
|
||||||
|
|
||||||
|
When a block of text is diffed with the plugin, a "Differ" object is
|
||||||
|
initialized with its relevant data. The differ contains information about the
|
||||||
|
buffer number, filetype, start and end lines of the text, and a few other
|
||||||
|
things. Almost all functions the plugin uses are scoped to this object in
|
||||||
|
order to keep the interface simple. They're located under
|
||||||
|
"autoload/linediff/differ.vim" and should be fairly understandable.
|
||||||
|
|
||||||
|
Functions that are general-purpose utilities are placed in
|
||||||
|
"autoload/linediff/util.vim".
|
||||||
|
|
||||||
|
The two differ objects that are required for the two diff buffers are linked
|
||||||
|
to each other out of necessity. If they originate from a single buffer,
|
||||||
|
updating one would move the lines of the other, so that one would have to be
|
||||||
|
updated as well. Apart from that, they have no interaction.
|
||||||
|
|
||||||
|
==============================================================================
|
||||||
|
ISSUES *linediff-issues*
|
||||||
|
|
||||||
|
You shouldn't linediff two pieces of text that overlap. Not that anything
|
||||||
|
horribly bad will happen, it just won't work as you'd hope to. I don't feel
|
||||||
|
like it's a very important use case, but if someone requests sensible
|
||||||
|
behaviour in that case, I should be able to get it working.
|
||||||
|
|
||||||
|
To report any issues or offer suggestions, use the bugtracker of the github
|
||||||
|
project at http://github.com/AndrewRadev/linediff.vim/issues
|
||||||
|
|
||||||
|
vim:tw=78:sw=4:ft=help:norl:
|
@ -13,8 +13,10 @@
|
|||||||
:Hexplore pi_netrw.txt /*:Hexplore*
|
:Hexplore pi_netrw.txt /*:Hexplore*
|
||||||
:I visincr.txt /*:I*
|
:I visincr.txt /*:I*
|
||||||
:IA visincr.txt /*:IA*
|
:IA visincr.txt /*:IA*
|
||||||
|
:IB visincr.txt /*:IB*
|
||||||
:ID visincr.txt /*:ID*
|
:ID visincr.txt /*:ID*
|
||||||
:II visincr.txt /*:II*
|
:II visincr.txt /*:II*
|
||||||
|
:IIB visincr.txt /*:IIB*
|
||||||
:IIO visincr.txt /*:IIO*
|
:IIO visincr.txt /*:IIO*
|
||||||
:IIR visincr.txt /*:IIR*
|
:IIR visincr.txt /*:IIR*
|
||||||
:IIX visincr.txt /*:IIX*
|
:IIX visincr.txt /*:IIX*
|
||||||
@ -25,6 +27,8 @@
|
|||||||
:IX visincr.txt /*:IX*
|
:IX visincr.txt /*:IX*
|
||||||
:LP LogiPat.txt /*:LP*
|
:LP LogiPat.txt /*:LP*
|
||||||
:LPF LogiPat.txt /*:LPF*
|
:LPF LogiPat.txt /*:LPF*
|
||||||
|
:Linediff linediff.txt /*:Linediff*
|
||||||
|
:LinediffReset linediff.txt /*:LinediffReset*
|
||||||
:LogiPat LogiPat.txt /*:LogiPat*
|
:LogiPat LogiPat.txt /*:LogiPat*
|
||||||
:MatchDebug matchit.txt /*:MatchDebug*
|
:MatchDebug matchit.txt /*:MatchDebug*
|
||||||
:MkVimball pi_vimball.txt /*:MkVimball*
|
:MkVimball pi_vimball.txt /*:MkVimball*
|
||||||
@ -1595,6 +1599,7 @@ g:tcommentSyntaxMap tcomment.txt /*g:tcommentSyntaxMap*
|
|||||||
g:vimball_home pi_vimball.txt /*g:vimball_home*
|
g:vimball_home pi_vimball.txt /*g:vimball_home*
|
||||||
g:vimball_mkdir pi_vimball.txt /*g:vimball_mkdir*
|
g:vimball_mkdir pi_vimball.txt /*g:vimball_mkdir*
|
||||||
g:visincr_datedivset visincr.txt /*g:visincr_datedivset*
|
g:visincr_datedivset visincr.txt /*g:visincr_datedivset*
|
||||||
|
g:visincr_longcmd visincr.txt /*g:visincr_longcmd*
|
||||||
getlatestvimscripts-install pi_getscript.txt /*getlatestvimscripts-install*
|
getlatestvimscripts-install pi_getscript.txt /*getlatestvimscripts-install*
|
||||||
getscript pi_getscript.txt /*getscript*
|
getscript pi_getscript.txt /*getscript*
|
||||||
getscript-autoinstall pi_getscript.txt /*getscript-autoinstall*
|
getscript-autoinstall pi_getscript.txt /*getscript-autoinstall*
|
||||||
@ -1627,6 +1632,13 @@ gundo_preview_height gundo.txt /*gundo_preview_height*
|
|||||||
gundo_right gundo.txt /*gundo_right*
|
gundo_right gundo.txt /*gundo_right*
|
||||||
gundo_width gundo.txt /*gundo_width*
|
gundo_width gundo.txt /*gundo_width*
|
||||||
http pi_netrw.txt /*http*
|
http pi_netrw.txt /*http*
|
||||||
|
linediff linediff.txt /*linediff*
|
||||||
|
linediff-commands linediff.txt /*linediff-commands*
|
||||||
|
linediff-contents linediff.txt /*linediff-contents*
|
||||||
|
linediff-installation linediff.txt /*linediff-installation*
|
||||||
|
linediff-internals linediff.txt /*linediff-internals*
|
||||||
|
linediff-issues linediff.txt /*linediff-issues*
|
||||||
|
linediff-usage linediff.txt /*linediff-usage*
|
||||||
local_markfilelist pi_netrw.txt /*local_markfilelist*
|
local_markfilelist pi_netrw.txt /*local_markfilelist*
|
||||||
logipat LogiPat.txt /*logipat*
|
logipat LogiPat.txt /*logipat*
|
||||||
logipat-arg LogiPat.txt /*logipat-arg*
|
logipat-arg LogiPat.txt /*logipat-arg*
|
||||||
@ -1904,13 +1916,14 @@ vimball-history pi_vimball.txt /*vimball-history*
|
|||||||
vimball-intro pi_vimball.txt /*vimball-intro*
|
vimball-intro pi_vimball.txt /*vimball-intro*
|
||||||
vimball-manual pi_vimball.txt /*vimball-manual*
|
vimball-manual pi_vimball.txt /*vimball-manual*
|
||||||
vimball-windows pi_vimball.txt /*vimball-windows*
|
vimball-windows pi_vimball.txt /*vimball-windows*
|
||||||
viscinr-I visincr.txt /*viscinr-I*
|
|
||||||
viscinr-contents visincr.txt /*viscinr-contents*
|
|
||||||
visincr visincr.txt /*visincr*
|
visincr visincr.txt /*visincr*
|
||||||
|
visincr-I visincr.txt /*visincr-I*
|
||||||
visincr-IA visincr.txt /*visincr-IA*
|
visincr-IA visincr.txt /*visincr-IA*
|
||||||
|
visincr-IB visincr.txt /*visincr-IB*
|
||||||
visincr-ID visincr.txt /*visincr-ID*
|
visincr-ID visincr.txt /*visincr-ID*
|
||||||
visincr-IDMY visincr.txt /*visincr-IDMY*
|
visincr-IDMY visincr.txt /*visincr-IDMY*
|
||||||
visincr-II visincr.txt /*visincr-II*
|
visincr-II visincr.txt /*visincr-II*
|
||||||
|
visincr-IIB visincr.txt /*visincr-IIB*
|
||||||
visincr-IIO visincr.txt /*visincr-IIO*
|
visincr-IIO visincr.txt /*visincr-IIO*
|
||||||
visincr-IIPOW visincr.txt /*visincr-IIPOW*
|
visincr-IIPOW visincr.txt /*visincr-IIPOW*
|
||||||
visincr-IIR visincr.txt /*visincr-IIR*
|
visincr-IIR visincr.txt /*visincr-IIR*
|
||||||
@ -1932,6 +1945,7 @@ visincr-RIMDY visincr.txt /*visincr-RIMDY*
|
|||||||
visincr-RIPOW visincr.txt /*visincr-RIPOW*
|
visincr-RIPOW visincr.txt /*visincr-RIPOW*
|
||||||
visincr-RIYMD visincr.txt /*visincr-RIYMD*
|
visincr-RIYMD visincr.txt /*visincr-RIYMD*
|
||||||
visincr-calutil visincr.txt /*visincr-calutil*
|
visincr-calutil visincr.txt /*visincr-calutil*
|
||||||
|
visincr-contents visincr.txt /*visincr-contents*
|
||||||
visincr-copyright visincr.txt /*visincr-copyright*
|
visincr-copyright visincr.txt /*visincr-copyright*
|
||||||
visincr-decrease visincr.txt /*visincr-decrease*
|
visincr-decrease visincr.txt /*visincr-decrease*
|
||||||
visincr-decrement visincr.txt /*visincr-decrement*
|
visincr-decrement visincr.txt /*visincr-decrement*
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -1,102 +0,0 @@
|
|||||||
" Vim BlockDiff-Plugin
|
|
||||||
"
|
|
||||||
" Author: Timo Teifel
|
|
||||||
" Email: timo dot teifel at teifel dot net
|
|
||||||
" Version: 1.1
|
|
||||||
" Date: 23 Oct 2007
|
|
||||||
" Licence: GPL v2.0
|
|
||||||
"
|
|
||||||
" Usage:
|
|
||||||
" - Select first block
|
|
||||||
" - Depending on the configuration, select:
|
|
||||||
" - Menu Tools->BlockDiff-> This\ is\ Block\ 1
|
|
||||||
" - Popup-Menu -> This\ is\ Block\ 1
|
|
||||||
" - :BlockDiff1
|
|
||||||
" - ,d1
|
|
||||||
" - select second block (may be in another file, but in the same
|
|
||||||
" Vim window)
|
|
||||||
" - Menu Tools->BlockDiff-> This\ is\ Block\ 2,\ start\ diff
|
|
||||||
" - Popup-Menu -> This\ is\ Block\ 2,\ start\ diff
|
|
||||||
" - :BlockDiff2
|
|
||||||
" - ,d2
|
|
||||||
" - Script opens a new tab, splits it and shows the diff between
|
|
||||||
" the two blocks.
|
|
||||||
" - Close the tab when done
|
|
||||||
"
|
|
||||||
" History:
|
|
||||||
" V1.0: Initial upload
|
|
||||||
" V1.1: Added commands and inclusion guard, Thanks to Ingo Karkat
|
|
||||||
|
|
||||||
|
|
||||||
" Avoid installing twice or when in compatible mode
|
|
||||||
if exists('g:loaded_blockdiff') || (v:version < 700)
|
|
||||||
finish
|
|
||||||
endif
|
|
||||||
let g:loaded_blockdiff = 1
|
|
||||||
|
|
||||||
|
|
||||||
let s:save_cpo = &cpo
|
|
||||||
set cpo&vim
|
|
||||||
|
|
||||||
" ---------- Configuration ----------------------------------------------------
|
|
||||||
" uncomment one or more of these blocks:
|
|
||||||
|
|
||||||
|
|
||||||
" Create menu entry:
|
|
||||||
vmenu 40.352.10 &Tools.Bloc&kDiff.This\ is\ Block\ &1 :call BlockDiff_GetBlock1()<CR>
|
|
||||||
vmenu 40.352.20 &Tools.Bloc&kDiff.This\ is\ Block\ &2,\ start\ diff :call BlockDiff_GetBlock2()<CR>
|
|
||||||
|
|
||||||
|
|
||||||
" Create popup-menu-entry:
|
|
||||||
"vmenu PopUp.BlockDiff.This\ is\ Block\ 1 :call BlockDiff_GetBlock1()<CR>
|
|
||||||
"vmenu PopUp.BlockDiff.This\ is\ Block\ 2,\ start\ diff :call BlockDiff_GetBlock2()<CR>
|
|
||||||
|
|
||||||
" Shortcuts
|
|
||||||
"vmap ,d1 :call BlockDiff_GetBlock1()<CR>
|
|
||||||
"vmap ,d2 :call BlockDiff_GetBlock2()<CR>
|
|
||||||
|
|
||||||
" Commands
|
|
||||||
command! -range BlockDiff1 :<line1>,<line2>call BlockDiff_GetBlock1()
|
|
||||||
command! -range BlockDiff2 :<line1>,<line2>call BlockDiff_GetBlock2()
|
|
||||||
|
|
||||||
|
|
||||||
" ---------- Code -------------------------------------------------------------
|
|
||||||
fun! BlockDiff_GetBlock1() range
|
|
||||||
let s:regd = @@
|
|
||||||
" copy selected block into unnamed register
|
|
||||||
exe a:firstline . "," . a:lastline . "y"
|
|
||||||
" save block for later use in variable
|
|
||||||
let s:block1 = @@
|
|
||||||
" restore unnamed register
|
|
||||||
let @@ = s:regd
|
|
||||||
endfun
|
|
||||||
|
|
||||||
fun! BlockDiff_GetBlock2() range
|
|
||||||
let s:regd = @@
|
|
||||||
exe a:firstline . "," . a:lastline . "y"
|
|
||||||
|
|
||||||
" Open new tab, paste second selected block
|
|
||||||
tabnew
|
|
||||||
normal P
|
|
||||||
" to prevent 'No write since last change' message:
|
|
||||||
se buftype=nowrite
|
|
||||||
diffthis
|
|
||||||
|
|
||||||
" vsplit left for first selected block
|
|
||||||
lefta vnew
|
|
||||||
" copy first block into unnamed register & paste
|
|
||||||
let @@ = s:block1
|
|
||||||
normal P
|
|
||||||
se buftype=nowrite
|
|
||||||
|
|
||||||
" start diff
|
|
||||||
diffthis
|
|
||||||
|
|
||||||
" restore unnamed register
|
|
||||||
let @@ = s:regd
|
|
||||||
endfun
|
|
||||||
|
|
||||||
|
|
||||||
let &cpo = s:save_cpo
|
|
||||||
unlet s:save_cpo
|
|
||||||
|
|
51
vimfiles/plugin/linediff.vim
Normal file
51
vimfiles/plugin/linediff.vim
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
if exists("g:loaded_linediff") || &cp
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
|
||||||
|
let g:loaded_linediff = '0.1.0' " version number
|
||||||
|
let s:keepcpo = &cpo
|
||||||
|
set cpo&vim
|
||||||
|
|
||||||
|
" Initialized lazily to avoid executing the autoload file before it's really
|
||||||
|
" needed.
|
||||||
|
"
|
||||||
|
" TODO Experiment to see if this matters at all.
|
||||||
|
"
|
||||||
|
function! s:Init()
|
||||||
|
if !exists('s:differ_one')
|
||||||
|
let s:differ_one = linediff#differ#New('linediff_one', 1)
|
||||||
|
let s:differ_two = linediff#differ#New('linediff_two', 2)
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
command! -range Linediff call s:Linediff(<line1>, <line2>)
|
||||||
|
function! s:Linediff(from, to)
|
||||||
|
call s:Init()
|
||||||
|
|
||||||
|
if s:differ_one.IsBlank()
|
||||||
|
call s:differ_one.Init(a:from, a:to)
|
||||||
|
elseif s:differ_two.IsBlank()
|
||||||
|
call s:differ_two.Init(a:from, a:to)
|
||||||
|
|
||||||
|
call s:PerformDiff(s:differ_one, s:differ_two)
|
||||||
|
else
|
||||||
|
call s:differ_one.Reset()
|
||||||
|
call s:differ_two.Reset()
|
||||||
|
|
||||||
|
call s:Linediff(a:from, a:to)
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
command! LinediffReset call s:LinediffReset()
|
||||||
|
function! s:LinediffReset()
|
||||||
|
call s:differ_one.Reset()
|
||||||
|
call s:differ_two.Reset()
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! s:PerformDiff(one, two)
|
||||||
|
call a:one.CreateDiffBuffer("tabedit")
|
||||||
|
call a:two.CreateDiffBuffer("rightbelow vsplit")
|
||||||
|
|
||||||
|
let a:one.other_differ = a:two
|
||||||
|
let a:two.other_differ = a:one
|
||||||
|
endfunction
|
@ -1,6 +1,6 @@
|
|||||||
" visincrPlugin.vim: Visual-block incremented lists
|
" visincrPlugin.vim: Visual-block incremented lists
|
||||||
" Author: Charles E. Campbell, Jr. Ph.D.
|
" Author: Charles E. Campbell, Jr. Ph.D.
|
||||||
" Date: Jul 18, 2006
|
" Date: Aug 16, 2011
|
||||||
" Public Interface Only
|
" Public Interface Only
|
||||||
"
|
"
|
||||||
" (James 2:19,20 WEB) You believe that God is one. You do well!
|
" (James 2:19,20 WEB) You believe that God is one. You do well!
|
||||||
@ -13,7 +13,7 @@
|
|||||||
if &cp || exists("g:loaded_visincrPlugin")
|
if &cp || exists("g:loaded_visincrPlugin")
|
||||||
finish
|
finish
|
||||||
endif
|
endif
|
||||||
let g:loaded_visincrPlugin = "v19"
|
let g:loaded_visincrPlugin = "v20"
|
||||||
let s:keepcpo = &cpo
|
let s:keepcpo = &cpo
|
||||||
set cpo&vim
|
set cpo&vim
|
||||||
|
|
||||||
@ -29,57 +29,112 @@ let s:IM = 6
|
|||||||
let s:IA = 7
|
let s:IA = 7
|
||||||
let s:IX = 8
|
let s:IX = 8
|
||||||
let s:IIX = 9
|
let s:IIX = 9
|
||||||
let s:IO = 10
|
let s:IB = 10
|
||||||
let s:IIO = 11
|
let s:IIB = 11
|
||||||
let s:IR = 12
|
let s:IO = 12
|
||||||
let s:IIR = 13
|
let s:IIO = 13
|
||||||
let s:IPOW = 14
|
let s:IR = 14
|
||||||
let s:IIPOW = 15
|
let s:IIR = 15
|
||||||
let s:RI = 16
|
let s:IPOW = 16
|
||||||
let s:RII = 17
|
let s:IIPOW = 17
|
||||||
let s:RIMDY = 18
|
let s:RI = 18
|
||||||
let s:RIYMD = 19
|
let s:RII = 19
|
||||||
let s:RIDMY = 20
|
let s:RIMDY = 20
|
||||||
let s:RID = 21
|
let s:RIYMD = 21
|
||||||
let s:RIM = 22
|
let s:RIDMY = 22
|
||||||
let s:RIA = 23
|
let s:RID = 23
|
||||||
let s:RIX = 24
|
let s:RIM = 24
|
||||||
let s:RIIX = 25
|
let s:RIA = 25
|
||||||
let s:RIO = 26
|
let s:RIX = 26
|
||||||
let s:RIIO = 27
|
let s:RIIX = 27
|
||||||
let s:RIR = 28
|
let s:RIB = 28
|
||||||
let s:RIIR = 29
|
let s:RIIB = 29
|
||||||
let s:RIPOW = 30
|
let s:RIO = 30
|
||||||
let s:RIIPOW = 31
|
let s:RIIO = 31
|
||||||
|
let s:RIR = 32
|
||||||
|
let s:RIIR = 33
|
||||||
|
let s:RIPOW = 34
|
||||||
|
let s:RIIPOW = 35
|
||||||
|
|
||||||
" ------------------------------------------------------------------------------
|
" ------------------------------------------------------------------------------
|
||||||
" Public Interface: {{{1
|
" Public Interface: {{{1
|
||||||
com! -ra -complete=expression -na=? I call visincr#VisBlockIncr(s:I , <f-args>)
|
if !exists("g:visincr_longcmd")
|
||||||
com! -ra -complete=expression -na=* II call visincr#VisBlockIncr(s:II , <f-args>)
|
com! -ra -complete=expression -na=? I call visincr#VisBlockIncr(s:I , <f-args>)
|
||||||
com! -ra -complete=expression -na=* IMDY call visincr#VisBlockIncr(s:IMDY , <f-args>)
|
com! -ra -complete=expression -na=* II call visincr#VisBlockIncr(s:II , <f-args>)
|
||||||
com! -ra -complete=expression -na=* IYMD call visincr#VisBlockIncr(s:IYMD , <f-args>)
|
com! -ra -complete=expression -na=* IMDY call visincr#VisBlockIncr(s:IMDY , <f-args>)
|
||||||
com! -ra -complete=expression -na=* IDMY call visincr#VisBlockIncr(s:IDMY , <f-args>)
|
com! -ra -complete=expression -na=* IYMD call visincr#VisBlockIncr(s:IYMD , <f-args>)
|
||||||
com! -ra -complete=expression -na=? ID call visincr#VisBlockIncr(s:ID , <f-args>)
|
com! -ra -complete=expression -na=* IDMY call visincr#VisBlockIncr(s:IDMY , <f-args>)
|
||||||
com! -ra -complete=expression -na=? IM call visincr#VisBlockIncr(s:IM , <f-args>)
|
com! -ra -complete=expression -na=? ID call visincr#VisBlockIncr(s:ID , <f-args>)
|
||||||
com! -ra -complete=expression -na=? IA call visincr#VisBlockIncr(s:IA , <f-args>)
|
com! -ra -complete=expression -na=? IM call visincr#VisBlockIncr(s:IM , <f-args>)
|
||||||
com! -ra -complete=expression -na=? IX call visincr#VisBlockIncr(s:IX , <f-args>)
|
com! -ra -complete=expression -na=? IA call visincr#VisBlockIncr(s:IA , <f-args>)
|
||||||
com! -ra -complete=expression -na=? IIX call visincr#VisBlockIncr(s:IIX , <f-args>)
|
com! -ra -complete=expression -na=? IX call visincr#VisBlockIncr(s:IX , <f-args>)
|
||||||
com! -ra -complete=expression -na=? IO call visincr#VisBlockIncr(s:IO , <f-args>)
|
com! -ra -complete=expression -na=* IIX call visincr#VisBlockIncr(s:IIX , <f-args>)
|
||||||
com! -ra -complete=expression -na=? IIO call visincr#VisBlockIncr(s:IIO , <f-args>)
|
com! -ra -complete=expression -na=? IB call visincr#VisBlockIncr(s:IB , <f-args>)
|
||||||
com! -ra -complete=expression -na=? IR call visincr#VisBlockIncr(s:IR , <f-args>)
|
com! -ra -complete=expression -na=* IIB call visincr#VisBlockIncr(s:IIB , <f-args>)
|
||||||
com! -ra -complete=expression -na=? IIR call visincr#VisBlockIncr(s:IIR , <f-args>)
|
com! -ra -complete=expression -na=? IO call visincr#VisBlockIncr(s:IO , <f-args>)
|
||||||
com! -ra -complete=expression -na=? IPOW call visincr#VisBlockIncr(s:IPOW , <f-args>)
|
com! -ra -complete=expression -na=* IIO call visincr#VisBlockIncr(s:IIO , <f-args>)
|
||||||
com! -ra -complete=expression -na=? IIPOW call visincr#VisBlockIncr(s:IIPOW , <f-args>)
|
com! -ra -complete=expression -na=? IR call visincr#VisBlockIncr(s:IR , <f-args>)
|
||||||
|
com! -ra -complete=expression -na=* IIR call visincr#VisBlockIncr(s:IIR , <f-args>)
|
||||||
|
com! -ra -complete=expression -na=? IPOW call visincr#VisBlockIncr(s:IPOW , <f-args>)
|
||||||
|
com! -ra -complete=expression -na=* IIPOW call visincr#VisBlockIncr(s:IIPOW , <f-args>)
|
||||||
|
|
||||||
com! -ra -complete=expression -na=? RI call visincr#VisBlockIncr(s:RI , <f-args>)
|
com! -ra -complete=expression -na=? RI call visincr#VisBlockIncr(s:RI , <f-args>)
|
||||||
com! -ra -complete=expression -na=* RII call visincr#VisBlockIncr(s:RII , <f-args>)
|
com! -ra -complete=expression -na=* RII call visincr#VisBlockIncr(s:RII , <f-args>)
|
||||||
com! -ra -complete=expression -na=* RIMDY call visincr#VisBlockIncr(s:RIMDY , <f-args>)
|
com! -ra -complete=expression -na=* RIMDY call visincr#VisBlockIncr(s:RIMDY , <f-args>)
|
||||||
com! -ra -complete=expression -na=* RIYMD call visincr#VisBlockIncr(s:RIYMD , <f-args>)
|
com! -ra -complete=expression -na=* RIYMD call visincr#VisBlockIncr(s:RIYMD , <f-args>)
|
||||||
com! -ra -complete=expression -na=* RIDMY call visincr#VisBlockIncr(s:RIDMY , <f-args>)
|
com! -ra -complete=expression -na=* RIDMY call visincr#VisBlockIncr(s:RIDMY , <f-args>)
|
||||||
com! -ra -complete=expression -na=? RID call visincr#VisBlockIncr(s:RID , <f-args>)
|
com! -ra -complete=expression -na=? RID call visincr#VisBlockIncr(s:RID , <f-args>)
|
||||||
com! -ra -complete=expression -na=? RIM call visincr#VisBlockIncr(s:RIM , <f-args>)
|
com! -ra -complete=expression -na=? RIA call visincr#VisBlockIncr(s:RIA , <f-args>)
|
||||||
com! -ra -complete=expression -na=? RIPOW call visincr#VisBlockIncr(s:RIPOW , <f-args>)
|
com! -ra -complete=expression -na=? RIX call visincr#VisBlockIncr(s:RIX , <f-args>)
|
||||||
com! -ra -complete=expression -na=* RIIPOW call visincr#VisBlockIncr(s:RIIPOW , <f-args>)
|
com! -ra -complete=expression -na=? RIIX call visincr#VisBlockIncr(s:RIIX , <f-args>)
|
||||||
|
com! -ra -complete=expression -na=? RIB call visincr#VisBlockIncr(s:RIB , <f-args>)
|
||||||
|
com! -ra -complete=expression -na=? RIIB call visincr#VisBlockIncr(s:RIIB , <f-args>)
|
||||||
|
com! -ra -complete=expression -na=? RIO call visincr#VisOlockIncr(s:RIO , <f-args>)
|
||||||
|
com! -ra -complete=expression -na=? RIIO call visincr#VisOlockIncr(s:RIIO , <f-args>)
|
||||||
|
com! -ra -complete=expression -na=? RIR call visincr#VisRlockIncr(s:RIR , <f-args>)
|
||||||
|
com! -ra -complete=expression -na=? RIIR call visincr#VisRlockIncr(s:RIIR , <f-args>)
|
||||||
|
com! -ra -complete=expression -na=? RIM call visincr#VisBlockIncr(s:RIM , <f-args>)
|
||||||
|
com! -ra -complete=expression -na=? RIPOW call visincr#VisBlockIncr(s:RIPOW , <f-args>)
|
||||||
|
com! -ra -complete=expression -na=* RIIPOW call visincr#VisBlockIncr(s:RIIPOW , <f-args>)
|
||||||
|
else
|
||||||
|
com! -ra -complete=expression -na=? VI_I call visincr#VisBlockIncr(s:I , <f-args>)
|
||||||
|
com! -ra -complete=expression -na=* VI_II call visincr#VisBlockIncr(s:II , <f-args>)
|
||||||
|
com! -ra -complete=expression -na=* VI_IMDY call visincr#VisBlockIncr(s:IMDY , <f-args>)
|
||||||
|
com! -ra -complete=expression -na=* VI_IYMD call visincr#VisBlockIncr(s:IYMD , <f-args>)
|
||||||
|
com! -ra -complete=expression -na=* VI_IDMY call visincr#VisBlockIncr(s:IDMY , <f-args>)
|
||||||
|
com! -ra -complete=expression -na=? VI_ID call visincr#VisBlockIncr(s:ID , <f-args>)
|
||||||
|
com! -ra -complete=expression -na=? VI_IM call visincr#VisBlockIncr(s:IM , <f-args>)
|
||||||
|
com! -ra -complete=expression -na=? VI_IA call visincr#VisBlockIncr(s:IA , <f-args>)
|
||||||
|
com! -ra -complete=expression -na=? VI_IX call visincr#VisBlockIncr(s:IX , <f-args>)
|
||||||
|
com! -ra -complete=expression -na=* VI_IIX call visincr#VisBlockIncr(s:IIX , <f-args>)
|
||||||
|
com! -ra -complete=expression -na=? VI_IB call visincr#VisBlockIncr(s:IB , <f-args>)
|
||||||
|
com! -ra -complete=expression -na=* VI_IIB call visincr#VisBlockIncr(s:IIB , <f-args>)
|
||||||
|
com! -ra -complete=expression -na=? VI_IO call visincr#VisBlockIncr(s:IO , <f-args>)
|
||||||
|
com! -ra -complete=expression -na=* VI_IIO call visincr#VisBlockIncr(s:IIO , <f-args>)
|
||||||
|
com! -ra -complete=expression -na=? VI_IR call visincr#VisBlockIncr(s:IR , <f-args>)
|
||||||
|
com! -ra -complete=expression -na=* VI_IIR call visincr#VisBlockIncr(s:IIR , <f-args>)
|
||||||
|
com! -ra -complete=expression -na=? VI_IPOW call visincr#VisBlockIncr(s:IPOW , <f-args>)
|
||||||
|
com! -ra -complete=expression -na=* VI_IIPOW call visincr#VisBlockIncr(s:IIPOW , <f-args>)
|
||||||
|
|
||||||
|
com! -ra -complete=expression -na=? VI_RI call visincr#VisBlockIncr(s:RI , <f-args>)
|
||||||
|
com! -ra -complete=expression -na=* VI_RII call visincr#VisBlockIncr(s:RII , <f-args>)
|
||||||
|
com! -ra -complete=expression -na=* VI_RIMDY call visincr#VisBlockIncr(s:RIMDY , <f-args>)
|
||||||
|
com! -ra -complete=expression -na=* VI_RIYMD call visincr#VisBlockIncr(s:RIYMD , <f-args>)
|
||||||
|
com! -ra -complete=expression -na=* VI_RIDMY call visincr#VisBlockIncr(s:RIDMY , <f-args>)
|
||||||
|
com! -ra -complete=expression -na=? VI_RID call visincr#VisBlockIncr(s:RID , <f-args>)
|
||||||
|
com! -ra -complete=expression -na=? VI_RIA call visincr#VisBlockIncr(s:RIA , <f-args>)
|
||||||
|
com! -ra -complete=expression -na=? VI_RIX call visincr#VisBlockIncr(s:RIX , <f-args>)
|
||||||
|
com! -ra -complete=expression -na=? VI_RIIX call visincr#VisBlockIncr(s:RIIX , <f-args>)
|
||||||
|
com! -ra -complete=expression -na=? VI_RIB call visincr#VisBlockIncr(s:RIB , <f-args>)
|
||||||
|
com! -ra -complete=expression -na=? VI_RIIB call visincr#VisBlockIncr(s:RIIB , <f-args>)
|
||||||
|
com! -ra -complete=expression -na=? VI_RIO call visincr#VisOlockIncr(s:RIO , <f-args>)
|
||||||
|
com! -ra -complete=expression -na=? VI_RIIO call visincr#VisOlockIncr(s:RIIO , <f-args>)
|
||||||
|
com! -ra -complete=expression -na=? VI_RIR call visincr#VisRlockIncr(s:RIR , <f-args>)
|
||||||
|
com! -ra -complete=expression -na=? VI_RIIR call visincr#VisRlockIncr(s:RIIR , <f-args>)
|
||||||
|
com! -ra -complete=expression -na=? VI_RIM call visincr#VisBlockIncr(s:RIM , <f-args>)
|
||||||
|
com! -ra -complete=expression -na=? VI_RIPOW call visincr#VisBlockIncr(s:RIPOW , <f-args>)
|
||||||
|
com! -ra -complete=expression -na=* VI_RIIPOW call visincr#VisBlockIncr(s:RIIPOW , <f-args>)
|
||||||
|
endif
|
||||||
|
|
||||||
" ---------------------------------------------------------------------
|
" ---------------------------------------------------------------------
|
||||||
" Restoration And Modelines: {{{1
|
" Restoration And Modelines: {{{1
|
||||||
|
Loading…
x
Reference in New Issue
Block a user