Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Lets say I've got 10 lines:

1. Foo
2. Bar
3. Baz
4. Quz
5. Qaz

How could I select lines 1-3 and than 4-5.

share|improve this question
Isn't that identical to selecting lines 1-5? – Christian Mann Oct 9 '11 at 1:41

You'll need to use registers, because there's no way to highlight more than a single block at a time without using plugins.

The structure is "<register><action>.

Basic example:

Do a visual selection with either <C-v> (block) or <S-v> (line). Select your first block.

enter image description here

Yank/cut it into a register with "qy or "qx. q can be any letter, it's just the identifier of the register.

enter image description here

Do the same thing for the next block, but with a different register. "wy or "wx.

enter image description here

Now, both selections are in registers q and w respectively. Navigate to your targeted location and paste them with "qp or "wp.

enter image description here enter image description here

If you want to append the contents of the w register into the q register, you can do the following in command mode.

:let @q .= @w

You can also yank multiple lines without even entering visual mode. The command is "<register><number><action><movement>. Say if you want to yank the current row to 3 rows down into register z, type "z3yj". You should see a 4 lines yanked confirmation in the status bar.

share|improve this answer

Using registers would be the best way to go about it. But if you insist on having non-contiguous visual selection, then here's a plugin that does that -

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.