Home Explore Blog CI



neovim

3rd chunk of `runtime/doc/visual.txt`
7c01ecbe0a264c92aba5e355bc041537455255975ad617a30000000100000fa3
 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 not have a
		visual-mode mapping.

							*v_CTRL-C*
CTRL-C			In Visual mode: Stop Visual mode.  When insert mode is
			pending (the mode message shows
			"-- (insert) VISUAL --"), it is also stopped.
			On MS-Windows, you may need to press CTRL-Break.

==============================================================================
3. Changing the Visual area				*visual-change*

							*v_o*
o			Go to Other end of highlighted text: The current
			cursor position becomes the start of the highlighted
			text and the cursor is moved to the other end of the
			highlighted text.  The highlighted area remains the
			same.

							*v_O*
O			Go to Other end of highlighted text.  This is like
			"o", but in Visual block mode the cursor moves to the
			other corner in the same line.  When the corner is at
			a character that occupies more than one position on
			the screen (e.g., a <Tab>), the highlighted text may
			change.

							*v_$*
When the "$" command is used with blockwise Visual mode, the right end of the
highlighted text will be determined by the longest highlighted line.  This
stops when a motion command is used that does not move straight up or down.

For moving the end of the block many commands can be used, but you cannot
use Ex commands, commands that make changes or abandon the file.  Commands
(starting with) ".", "&", CTRL-^, "Z", CTRL-], CTRL-T, CTRL-R, CTRL-I
and CTRL-O cause a beep and Visual mode continues.

When switching to another window on the same buffer, the cursor position in
that window is adjusted, so that the same Visual area is still selected.  This
is especially useful to view the start of the Visual area in one window, and
the end in another.  You can then use <RightMouse> (or <S-LeftMouse> when
'mousemodel' is "popup") to drag either end of the Visual area.

==============================================================================
4. Operating on the Visual area				*visual-operators*

The operators that can be used are:
	~	switch case					|v_~|
	d	delete						|v_d|
	c	change (4)					|v_c|
	y	yank						|v_y|
	>	shift right (4)					|v_>|
	<	shift left (4)					|v_<|
	!	filter through external command (1)		|v_!|
	=	filter through 'equalprg' option command (1)	|v_=|
	gq	format lines to 'textwidth' length (1)		|v_gq|

The objects that can be used are:
	aw	a word (with white space)			|v_aw|
	iw	inner word					|v_iw|
	aW	a WORD (with white space)			|v_aW|
	iW	inner WORD					|v_iW|
	as	a sentence (with white space)			|v_as|
	is	inner sentence					|v_is|
	ap	a paragraph (with white space)			|v_ap|
	ip	inner paragraph					|v_ip|
	ab	a () block (with parentheses)			|v_ab|
	ib	inner () block					|v_ib|
	aB	a {} block (with braces)			|v_aB|
	iB	inner {} block					|v_iB|
	at	a <tag> </tag> block (with tags)		|v_at|
	it	inner <tag> </tag> block			|v_it|
	a<	a <> block (with <>)				|v_a<|
	i<	inner <> block					|v_i<|
	a[	a [] block (with [])				|v_a[|
	i[	inner [] block					|v_i[|
	a"	a double quoted string (with quotes)		|v_aquote|

Title: Visual Mode: Area Manipulation, Operators, and Objects
Summary
This section continues the discussion on Vim's Visual mode, detailing how the highlighted area is affected by counts and commands. It explains how the 'o' and 'O' commands switch the cursor to the other end of the selection, and how '$' works in blockwise Visual mode. It then covers the operators and objects that can be used in Visual mode, such as delete ('d'), change ('c'), yank ('y'), shift left/right ('<' and '>'), filter through external commands ('!'), and format lines ('gq'), as well as text objects like words, sentences, paragraphs, and blocks.