7

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?

1 Answers1

7

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.

Jacob
  • 80
Rook
  • 24,289