Home Explore Blog CI



neovim

2nd chunk of `runtime/doc/visual.txt`
92ce26c0a8b51842204710916dab359482bdb00b83070be90000000100000fa3
 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 last used search pattern, like
			with `n`, and start Visual mode to select the match.
			If the cursor is on the match, visually selects it.
			If an operator is pending, operates on the match.
			E.g., "dgn" deletes the text of the next match.
			If Visual mode is active, extends the selection
			until the end of the next match.
			'wrapscan' applies.
			Note: Unlike `n` the search direction does not depend
			on the previous search command.

								*gN* *v_gN*
gN			Like |gn| but searches backward, like with `N`.

							*<LeftMouse>*
<LeftMouse>		Set the current cursor position.  If Visual mode is
			active it is stopped.  Only when 'mouse' option
			contains 'n' or 'a'.  If the position is within 'so'
			lines from the last line on the screen the text is
			scrolled up.  If the position is within 'so' lines from
			the first line on the screen the text is scrolled
			down.

							*<RightMouse>*
<RightMouse>		Start Visual mode if it is not active.  The text from
			the cursor position to the position of the click is
			highlighted.  If Visual mode was already active move
			the start or end of the highlighted text, whichever
			is closest, to the position of the click.  Only when
			'mouse' option contains 'n' or 'a'.

			Note: when 'mousemodel' is set to "popup",
			<S-LeftMouse> has to be used instead of <RightMouse>.

							*<LeftRelease>*
<LeftRelease>		This works like a <LeftMouse>, if it is not at
			the same position as <LeftMouse>.  In an older version
			of xterm you won't see the selected area until the
			button is released, unless there is access to the
			display where the xterm is running (via the DISPLAY
			environment variable or the -display argument).  Only
			when 'mouse' option contains 'n' or 'a'.

If Visual mode is not active and the "v", "V" or CTRL-V is preceded with a
count, the size of the previously highlighted area is used for a start.  You
can then move the end of the highlighted area and give an operator.  The type
of the old area is used (character, line or blockwise).
- Linewise Visual mode: The number of lines is multiplied with the count.
- Blockwise Visual mode: The number of lines and columns is multiplied with
  the count.
- Normal Visual mode within one line: The number of characters is multiplied
  with the count.
- Normal Visual mode with several lines: The number of lines is multiplied
  with the count, in the last line the same number of characters is used as
  in the last line in the previously highlighted area.
The start of the text is the Cursor position.  If the "$" command was used as
one of the last commands to extend the highlighted text, the area will be
extended to the rightmost column of the longest line.

If you want to highlight exactly the same area as the last time, you can use
"gv" |gv| |v_gv|.

							*v_<Esc>*
<Esc>			In Visual mode: Stop Visual mode.
						*v_META* *v_ALT*
		ALT (|META|) may act like <Esc> if the chord is not mapped.
		For example <A-x> acts like <Esc>x if <A-x> does

Title: Visual Mode Interactions and Commands in Vim
Summary
This section details how Visual mode interacts with other commands and inputs in Vim. It explains how Visual mode is terminated by actions like jumping to another buffer, pressing Esc, or using specific mode-switching commands. It also covers commands like 'gv' to reselect the previous area, 'gn' and 'gN' to search forward or backward and select the match, and mouse actions to start, extend, or stop Visual mode. Finally, it describes how a preceding count affects the size of the highlighted area and how the Esc key is used to exit Visual mode.