Use '[ and '] marks instead of a-z marks

Closes #22.
This commit is contained in:
Tom McDonald 2014-04-08 17:09:22 -04:00
parent c307765978
commit 105cf06d43

View File

@ -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