Merge pull request #9 from Raimondi/patch-1
This commit is contained in:
commit
6e08553618
@ -1,25 +1,27 @@
|
||||
function! s:exchange(x, y)
|
||||
let a = getpos("'a")
|
||||
let b = getpos("'b")
|
||||
let reg = @@
|
||||
let reg = getreg('@')
|
||||
let reg_mode = getregtype('@')
|
||||
|
||||
call setpos("'a", a:y[2])
|
||||
call setpos("'b", a:y[3])
|
||||
let @@ = a:x[0]
|
||||
call setreg('@', a:x[0], a:x[1])
|
||||
silent exe "normal! `a" . a:y[1] . "`b\"\"p"
|
||||
|
||||
call setpos("'a", a:x[2])
|
||||
call setpos("'b", a:x[3])
|
||||
let @@ = a:y[0]
|
||||
call setreg('@', a:y[0], a:y[1])
|
||||
silent exe "normal! `a" . a:x[1] . "`b\"\"p"
|
||||
|
||||
call setpos("'a", a)
|
||||
call setpos("'b", b)
|
||||
let @@ = reg
|
||||
call setreg('@', reg, reg_mode)
|
||||
endfunction
|
||||
|
||||
function! s:exchange_get(type, vis)
|
||||
let reg = @@
|
||||
let reg = getreg('@')
|
||||
let reg_mode = getregtype('@')
|
||||
let selection = &selection
|
||||
let &selection = 'inclusive'
|
||||
if a:vis
|
||||
@ -40,7 +42,7 @@ function! s:exchange_get(type, vis)
|
||||
silent exe "normal! `[v`]y"
|
||||
endif
|
||||
let text = @@
|
||||
let @@ = reg
|
||||
call setreg('@', reg, reg_mode)
|
||||
let &selection = selection
|
||||
return [text, type, start, end]
|
||||
endfunction
|
||||
|
Loading…
x
Reference in New Issue
Block a user