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