Merge pull request #30 from wilywampa/master
Restore star and plus registers in addition to unnamed register
This commit is contained in:
commit
fd0e870abd
@ -3,6 +3,10 @@ function! s:exchange(x, y, reverse, expand)
|
|||||||
let reg_z_mode = getregtype('z')
|
let reg_z_mode = getregtype('z')
|
||||||
let reg_unnamed = getreg('"')
|
let reg_unnamed = getreg('"')
|
||||||
let reg_unnamed_mode = getregtype('"')
|
let reg_unnamed_mode = getregtype('"')
|
||||||
|
let reg_star = getreg('*')
|
||||||
|
let reg_star_mode = getregtype('*')
|
||||||
|
let reg_plus = getreg('+')
|
||||||
|
let reg_plus_mode = getregtype('+')
|
||||||
let selection = &selection
|
let selection = &selection
|
||||||
set selection=inclusive
|
set selection=inclusive
|
||||||
|
|
||||||
@ -27,11 +31,17 @@ function! s:exchange(x, y, reverse, expand)
|
|||||||
let &selection = selection
|
let &selection = selection
|
||||||
call setreg('z', reg_z, reg_z_mode)
|
call setreg('z', reg_z, reg_z_mode)
|
||||||
call setreg('"', reg_unnamed, reg_unnamed_mode)
|
call setreg('"', reg_unnamed, reg_unnamed_mode)
|
||||||
|
call setreg('*', reg_star, reg_star_mode)
|
||||||
|
call setreg('+', reg_plus, reg_plus_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 reg_star = getreg('*')
|
||||||
|
let reg_star_mode = getregtype('*')
|
||||||
|
let reg_plus = getreg('+')
|
||||||
|
let reg_plus_mode = getregtype('+')
|
||||||
if a:vis
|
if a:vis
|
||||||
let type = a:type
|
let type = a:type
|
||||||
let [start, end] = s:store_pos("'<", "'>")
|
let [start, end] = s:store_pos("'<", "'>")
|
||||||
@ -59,6 +69,8 @@ function! s:exchange_get(type, vis)
|
|||||||
endif
|
endif
|
||||||
let text = getreg('@')
|
let text = getreg('@')
|
||||||
call setreg('"', reg, reg_mode)
|
call setreg('"', reg, reg_mode)
|
||||||
|
call setreg('*', reg_star, reg_star_mode)
|
||||||
|
call setreg('+', reg_plus, reg_plus_mode)
|
||||||
return [text, type, start, end]
|
return [text, type, start, end]
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user