From 483a294cce131223dee03a242fa967922c937d61 Mon Sep 17 00:00:00 2001 From: Jacob Niehus Date: Sat, 2 Aug 2014 13:44:31 -0700 Subject: [PATCH] Restore star and plus registers in addition to unnamed register --- plugin/exchange.vim | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/plugin/exchange.vim b/plugin/exchange.vim index 4f1624f..fd32217 100644 --- a/plugin/exchange.vim +++ b/plugin/exchange.vim @@ -3,6 +3,10 @@ function! s:exchange(x, y, reverse, expand) let reg_z_mode = getregtype('z') let reg_unnamed = getreg('"') 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 set selection=inclusive @@ -27,11 +31,17 @@ function! s:exchange(x, y, reverse, expand) let &selection = selection call setreg('z', reg_z, reg_z_mode) call setreg('"', reg_unnamed, reg_unnamed_mode) + call setreg('*', reg_star, reg_star_mode) + call setreg('+', reg_plus, reg_plus_mode) endfunction function! s:exchange_get(type, vis) let reg = getreg('"') 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 let type = a:type let [start, end] = s:store_pos("'<", "'>") @@ -59,6 +69,8 @@ function! s:exchange_get(type, vis) endif let text = getreg('@') call setreg('"', reg, reg_mode) + call setreg('*', reg_star, reg_star_mode) + call setreg('+', reg_plus, reg_plus_mode) return [text, type, start, end] endfunction