From 105cf06d438c73dc3f27413eeb2e2ba9323d951a Mon Sep 17 00:00:00 2001 From: Tom McDonald Date: Tue, 8 Apr 2014 17:09:22 -0400 Subject: [PATCH] Use '[ and '] marks instead of a-z marks Closes #22. --- plugin/exchange.vim | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/plugin/exchange.vim b/plugin/exchange.vim index c7d18d5..dd2ba61 100644 --- a/plugin/exchange.vim +++ b/plugin/exchange.vim @@ -1,20 +1,18 @@ function! s:exchange(x, y, reverse) - let mark_a = getpos("'y") - let mark_b = getpos("'t") let reg_z = getreg('z') let reg_z_mode = getregtype('z') let reg_unnamed = getreg('"') let reg_unnamed_mode = getregtype('"') - call setpos("'y", a:y[2]) - call setpos("'t", a:y[3]) + call setpos("'[", a:y[2]) + call setpos("']", a:y[3]) call setreg('z', a:x[0], a:x[1]) - silent exe "normal! `y" . a:y[1] . "`t\"zp" + silent exe "normal! `[" . a:y[1] . "`]\"zp" - call setpos("'y", a:x[2]) - call setpos("'t", a:x[3]) + call setpos("'[", a:x[2]) + call setpos("']", a:x[3]) call setreg('z', a:y[0], a:y[1]) - silent exe "normal! `y" . a:x[1] . "`t\"zp" + silent exe "normal! `[" . a:x[1] . "`]\"zp" if a:reverse call cursor(a:x[2][1], a:x[2][2]) @@ -22,8 +20,6 @@ function! s:exchange(x, y, reverse) call cursor(a:y[2][1], a:y[2][2]) endif - call setpos("'y", mark_a) - call setpos("'t", mark_b) call setreg('z', reg_z, reg_z_mode) call setreg('"', reg_unnamed, reg_unnamed_mode) endfunction