February 06 2014

How to use Visual Block in gvim if Ctrl-V doesn’t work?

Tagged Under : , , ,

How to use Visual Block in gvim if Ctrl-V doesn’t work?

In higher version of gvim (example gvim 7.x), Ctrl-V will not work as Visual Block, but it is for pasting text.

These are the steps to resolve visual block, instead of Ctrl-V:

1. Press “Esc”.
2. Move cursor to the desired starting block.
3. Press “Ctrl-Q”, then release.
4. Hold “Shift” key while moving cursor to ending block, then release.
5. press “Y” to yank.
6. Move cursor to new position and press “P” to paste.

Here is the example to copy vertical blocks for “3” and paste to new line.

Before:

12345
12345
12345

After:

12345
12345
12345
3
3
3

Note: You may download Vim or gVim at:

http://www.vim.org/download.php