Visual Mode
Visual mode is used to select text as a block to delete, copy, and modify (e.g., capitalize the first character of each word). When Visual mode is launched, the screen shows -- VISUAL --
.
Start Visual mode
v
: start the Visual mode with selecting the current character
V
: start the Visual mode with selecting the current line
Cursor movement
In Visual mode, you can mainly use arrows to extend the initial selection of a character or line (depending on how you start Visual mode).
Delete
You can use the d key, delete key, or backspace (delete + fn on Mac) to delete the selected text.
Copy
You can use the y key to copy (yank) selected text. Once you copy the selected text, Vim moves back to Normal mode. You can paste the copied text in Normal mode.
Change to upper or lower case
You can change the selected text to upper case or lower case using the U or u key.
U
: change the selected text to UPPER CASE
u
: change the selected text to lowercase
This is an example of changing the selected text to upper case.
Back to Normal mode
To move back to Normal mode, press the esc key. Also, Vim moves back to Normal mode automatically after you run a command (e.g., delete or copy).