Home Explore Blog CI



neovim

1st chunk of `runtime/doc/visual.txt`
2b985a6dc3b36ec5da1c4b4da7af194a4cd769c0dd78ef5b0000000100000fa0
*visual.txt*    Nvim


		  VIM REFERENCE MANUAL    by Bram Moolenaar


Visual mode				*Visual* *Visual-mode* *visual-mode*

Visual mode is a flexible and easy way to select a piece of text for an
operator.  It is the only way to select a block of text.

This is introduced in section |04.4| of the user manual.

                                      Type |gO| to see the table of contents.

==============================================================================
1. Using Visual mode					*visual-use*

Using Visual mode consists of three parts:
1. Mark the start of the text with "v", "V" or CTRL-V.
   The character under the cursor will be used as the start.
2. Move to the end of the text.
   The text from the start of the Visual mode up to and including the
   character under the cursor is highlighted.
3. Type an operator command.
   The highlighted characters will be operated upon.

The |hl-Visual| group determines the highlighting of the visual selection.
The 'virtualedit' option can be used to allow positioning the cursor to
positions where there is no actual character.

The highlighted text normally includes the character under the cursor.
However, when the 'selection' option is set to "exclusive" and the cursor is
after the Visual area, the character under the cursor is not included.

With "v" the text before the start position and after the end position will
not be highlighted.  However, all uppercase and non-alpha operators, except
"~" and "U", will work on whole lines anyway.  See the list of operators
below.

							*visual-block*
With CTRL-V (blockwise Visual mode) the highlighted text will be a rectangle
between start position and the cursor.  However, some operators work on whole
lines anyway (see the list below).  The change and substitute operators will
delete the highlighted text and then start insertion at the top left
position.

==============================================================================
2. Starting and stopping Visual mode			*visual-start*

						*v* *charwise-visual*
[count]v		Start Visual mode per character.
			With [count] select the same number of characters or
			lines as used for the last Visual operation, but at
			the current cursor position, multiplied by [count].
			When the previous Visual operation was on a block both
			the width and height of the block are multiplied by
			[count].
			When there was no previous Visual operation [count]
			characters are selected.  This is like moving the
			cursor right N * [count] characters.  One less when
			'selection' is not "exclusive".

						*V* *linewise-visual*
[count]V		Start Visual mode linewise.
			With [count] select the same number of lines as used
			for the last Visual operation, but at the current
			cursor position, multiplied by [count].  When there
			was no previous Visual operation [count] lines are
			selected.

						*CTRL-V* *blockwise-visual*
[count]CTRL-V		Start Visual mode blockwise.

If you use <Esc>, click the left mouse button or use any command that
does a jump to another buffer while in Visual mode, the highlighting stops
and no text is affected.  Also when you hit "v" in charwise Visual mode,
"CTRL-V" in blockwise Visual mode or "V" in linewise Visual mode.  If you hit
CTRL-Z the highlighting stops and the editor is suspended or a new shell is
started |CTRL-Z|.

	      new mode after typing:		*v_v* *v_CTRL-V* *v_V*
old mode	     "v"	      "CTRL-V"		     "V"	~

Normal		    Visual	   blockwise Visual	  linewise Visual
Visual		    Normal	   blockwise Visual	  linewise Visual
blockwise Visual    Visual	   Normal		  linewise Visual
linewise Visual     Visual	   blockwise Visual	  Normal

						*gv* *v_gv* *reselect-Visual*
gv			Start Visual mode with the same area as the previous
			area and the same mode.
			In Visual mode the current and the previous Visual
			area are exchanged.
			After using "p" or "P" in Visual mode the text that
			was put will be selected.

								*gn* *v_gn*
gn			Search forward for the

Title: Visual Mode in Vim: Usage, Starting, and Stopping
Summary
This section of the Vim reference manual explains Visual mode, a feature that allows users to select a block of text for an operator. It details the three parts of using Visual mode: marking the start of the text, moving to the end, and applying an operator. The section also describes how to start and stop Visual mode using 'v', 'V', and 'CTRL-V' for character-wise, line-wise, and block-wise selection, respectively. It further explains how to reselect the previous area using 'gv' and search forward using 'gn'.