Several commands in the [VIM] visual mode

Source: Internet
Author: User
several commands in the [VIM] Visual mode


Vim's visual mode allows us to select a text area and manipulate it. Vim has three visual modes for manipulating character text, line text, and block text, respectively. in Visual mode, many common-mode commands also perform the same function. Just moving the cursor in the visual mode changes the bounds of the highlighted selection.


1. Enter Visual mode


Command Use
V Enter a character-oriented visual mode
V
Go to line-oriented visual mode
Ctrl + V
Enter visual mode for column-oriented blocks
Gv
Re-election of the last highlighted constituency


2. Switch between visual modes


Command Use
Esc
Back to Normal mode
Ctrl + [
Back to Normal mode
v/v/Ctrl + V
In the corresponding mode will switch to normal mode,
That is, the same command is performed two times in normal mode or normal mode.
V
Toggles into a character-oriented visual mode in a pattern that does not correspond
V
Switch into line-oriented visual mode in a pattern that does not correspond
Ctrl + V
Toggles into the visual mode of a column-oriented block in a pattern that does not correspond


3. Toggle active end of highlighted selection


The range of highlighted selections is defined by its two endpoints. One end is fixed, and the other end is free to move with the cursor. You can toggle the active endpoint with the letter O to adjust the start position of the selection.

Command Use
O Toggle the active end of the highlighted selection,


4. Repeat line-oriented visual commands


Command Use
. After performing an operation in row visual mode, executing this command will cause the same range of lines of text to be re-elected and perform the same action
V
J
>
.
Enter the line-oriented visual mode, then use J to adjust the line bounds, execute the command indent command >
Perform in normal mode again. The visible row that you just selected is repeated and indents are performed.
It is advisable to use operator commands, not visual commands, whenever possible

5. From visual mode to insert mode

In visual mode, the I and a keys are used as part of the object, pressing I or a does not enter into the insert mode. You have to enter the insert mode with the I and a keys.


6. Reference: "Practical Vim"

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.