When is Visual mode used in Vim?

  1. When you want to comment a block of text.
    In command mode :
    Shift + v ,ctrl +v, j or k, I , #(comment character) and then Esc

    Vim inserts the comment character to the start of the block..

  2. is when I am using Gvim, I find it much easier to copy data to the clipboard through visual mode.
    In command mode :
    Shift + v , j or k , " , + ,y

    Here + is the clipboard register

    This to me is much more legible that using markers

  3. is for manual indenting

    Shift + v,
    Shift + > for moving to the right. Shift + < for moving to the left. . repeats

this is fun :-)


I use visual mode when I want to highlight a section of text. I start by typing v in standard mode, which then enables the visual mode. Then I use the arrow keys to move the cursor. This causes the text between my starting point and the current cursor location to be highlighted. Once you select a section of text like this, entering a command (e.g. search/replace) in command mode (by typing :) will only affect the selected area.

Another useful visual command is shift+v (visual line). This does the same as above, but it selects entire lines at a time instead of individual characters.