A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://learnbyexample.github.io/vim_reference/Visual-mode.html below:

Visual mode - Vim Reference Guide

Visual mode

Visual mode allows you to perform editing tasks on selected portions of text. There are various visual commands to select the text of interest. If enabled, you can also use your mouse to select the desired portions.

Documentation links:

Recall that you need to add v_ prefix for built-in help on Visual mode commands, for example :h v_o.

Selection

Pressing $ in block selection will select until the end of lines for the selected area, even if the lines have different number of characters. This will continue to be the case if you extend the selection with up/down motions.

Editing

Press Ctrl+c if you've typed text after using I or A but don't want to replicate the text across all the lines.

See :h visual-operators for a complete list of commands.

Search and Select

Searching will automatically wrap around when it reaches the top or bottom of the file contents, unless you set the nowrapscan option.

Indenting

Consider the following unindented code:

for(i=1; i&LT5; i++)
{
for(j=i; j&LT10; j++)
{
statements
}
statements
}

Here's the result after applying vip= (you can also use =ip if you prefer Normal mode).

for(i=1; i&LT5; i++)
{
    for(j=i; j&LT10; j++)
    {
        statements
    }
    statements
}

For block selection, space will be inserted before the starting column of the block.

Indentation depends on the shiftwidth setting. See :h shift-left-right, :h = and :h 'shiftwidth' for more details.

Changing Case Increment and Decrement numbers

The visual selection should cover the numeric portion you wish to increment or decrement. If there are multiple numbers in a visually selected line, only the first number will be affected.

Example for g followed by Ctrl+a:

# before
item[0]
item[0]
item[0]

# after
item[1]
item[2]
item[3]

Example for g followed by Ctrl+x:

# before
item[12]
item[16]
item[22]

# after
item[11]
item[14]
item[19]

Example for 3g followed by Ctrl+a:

# before
item[12]
item[16]
item[22]

# after
item[15]
item[22]
item[31]

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4