I was curious as to why exchange silently failed under the system version of Vim on OS X 10.9.1, when it worked fine under MacVim snapshot 72. I dug into it and found that the default register (") was being overwritten upon paste with the visually-selected text — which meant that the exchange was effectively a noop.
OS X 10.9.1 ships with Vim 7.3 (and no patches), whereas MacVim snapshot 72 is Vim 7.4 and patches 1–52. I searched the changelog and found patch 7.3.411:
Pasting in Visual mode using the "" register does not work.
It would also work to use a register other than the default, saving it up top and restoring it before returning. I can submit a pull request if you'd like — if so let me know which way you prefer.
I would prefer using another named register over "0; I feel it would be more reliable. If you'd like to submit a PR with that change I'd be happy to accept it :)
I was curious as to why exchange silently failed under the system version of Vim on OS X 10.9.1, when it worked fine under MacVim snapshot 72. I dug into it and found that the default register (") was being overwritten upon paste with the visually-selected text — which meant that the exchange was effectively a noop.
OS X 10.9.1 ships with Vim 7.3 (and no patches), whereas MacVim snapshot 72 is Vim 7.4 and patches 1–52. I searched the changelog and found patch 7.3.411:
Pasting from register 0 works around the bug:
It would also work to use a register other than the default, saving it up top and restoring it before returning. I can submit a pull request if you'd like — if so let me know which way you prefer.