Search code examples
vimvispacemacsevil-mode

Exchange point and mark in Vim selection


I want to exchange point and mark in a selection of text using vanilla Vim.

Consider a code block with some comments immediately preceding the block. Suppose I want to operate only on the code block. I can select the paragraph with vip. Doing this, however, places the cursor at the bottom of the paragraph. Were I able to exchange where the cursor is with where the selection starts, I could then move down.

<code>vip</code> <code>C-x C-x</code> <code>jj</code>

Since I am an Evil user, I can just do vip C-x C-x o jj, where the middle sequence is exchange-point-and-mark. How do I do it without Emacs?


Solution

  • This is command o in visual mode, aka v_o.