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

I am trying to migrate from Notepad++ to vi. In N++, I constantly rely on block edit (or "column mode"), as it is a great increase in productivity: I can select a rectangular area of text by pressing ALT before marking with the mouse, and copy, move, paste the rectangular area anywhere. Also, it is possible to drag the cursor vertically so that I can type simulatenously on several subsequent lines at the same time.

Is there any similar functionality for vi? If yes, how can I do that?

share|improve this question
Hi Paul, not really a duplicate. I admit a I am kind of asking two question at the same time, but my question was also about multi-line edit. – gojira Nov 30 '11 at 4:17
Yes. It's just that this is not mentioned in that other thread which you linked to, therefore I wouldn't say this thread is a duplicate. I pre-emptively mentioned this before this thread gets closed down. – gojira Nov 30 '11 at 4:23
Yes, but we all need to make an effort to reduce the number of duplicates or near duplicates from the site. To zero where possible. Had you searched first, you would have found the answer to the block question, then you could have just asked just the multiline edit question (but you would have probably figured it out in exploration). You could just edit your question to make it less dupey. – Paul Nov 30 '11 at 4:27
techie007: the answer in that other thread just sucks compared to the one Jacob gave below. I don't see why I should up-vote another answer which is much worse than the one given here. – gojira Dec 1 '11 at 2:34
@Paul - No we don't. What we need is to try to improve the quality of information available on this site. Duplicates are unrelated to quality. Often a better answer gets closed because there was already some (crappy) answer that answered the similar question. – Rook Dec 1 '11 at 17:28
up vote 5 down vote accepted

Really, vi? You sure you didn't mean, vim or gVim?

I'm gonna take a shot here and assume you ment the latter. gVim has got several ways of selecting text, the most similar to block edit in Notepad++, is conveniently also called block edit in gVim too. You start it up with Ctrlv and then select.

If you wish to "go over the blanks" as well, put this down

:set virtualedit=block

then repeat the part with Ctrlv. x cuts the selection, y yanks it (another word for copy), p pastes it. All of these have some variations on the theme. Vim really has a plethora of text manipulating features - I dare say, I don't know of any other editor that comes close to it in that respect.

Ups, just saw the other question in there as well. Typing in several lines, that is. Goes like this (one method): select the vertical column with Ctrlv, press I, type something down, press escape ... it should copy itself to all other lines as well.

Note that if you're using GVim on Windows, Ctrlv will attempt to put the system clipboard buffer by default. Ctrlq is an alternative keybinding to perform the same action on Windows.

share|improve this answer
Well I meant vi obviously including derivatives and modern versions; I thought that is understood when just saying "vi". Thank you for your answer. It works great! But one follow-up question: if I select a block of text as described, and then move the cursor to the beginning of a line and press "p", the block is inserted not at the very first position of the line but starting from the second position. Is this the default behaviour? Or what do I need to do to insert the block at the very beginning of the line? – gojira Nov 30 '11 at 4:15
@gojira: You wouldn't believe how many people say "vi" but mean the modern "vim" and expect to have colors, mouse support and everything in vi. – grawity Nov 30 '11 at 10:16
@gojira - Try "P". Yes, that is the ok behaviour. – Rook Nov 30 '11 at 11:31
@grawity, mouse support, PAH. I use my tiny little netbook with a tiny little trackpad. I'm glad I don't use a mouse. – Rob Nov 30 '11 at 20:52
@Rob: Okay, that's just ... I'm sorry, but how the hell is your despisal of computer mice relevant to this discussion? – grawity Dec 1 '11 at 14:14

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.