Home Explore Blog CI



neovim

4th chunk of `runtime/doc/visual.txt`
1e0515b72a46e0caf10ba1c368b2b74681c4bdbc8fa1c3d50000000100000fa1
			|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|
	i"	inner double quoted string			|v_iquote|
	a'	a single quoted string (with quotes)		|v_a'|
	i'	inner simple quoted string			|v_i'|
	a`	a string in backticks (with backticks)		|v_a`|
	i`	inner string in backticks			|v_i`|

Additionally the following commands can be used:
	:	start Ex command for highlighted lines (1)	|v_:|
	r	change (4)					|v_r|
	s	change						|v_s|
	C	change (2)(4)					|v_C|
	S	change (2)					|v_S|
	R	change (2)					|v_R|
	x	delete						|v_x|
	D	delete (3)					|v_D|
	X	delete (2)					|v_X|
	Y	yank (2)					|v_Y|
	p	put						|v_p|
	P	put without overwriting registers		|v_P|
	J	join (1)					|v_J|
	U	make uppercase					|v_U|
	u	make lowercase					|v_u|
	^]	find tag					|v_CTRL-]|
	I	block insert					|v_b_I|
	A	block append					|v_b_A|

(1): Always whole lines, see |:visual_example|.
(2): Whole lines when not using CTRL-V.
(3): Whole lines when not using CTRL-V, delete until the end of the line when
     using CTRL-V.
(4): When using CTRL-V operates on the block only.

Note that the ":vmap" command can be used to specifically map keys in Visual
mode.  For example, if you would like the "/" command not to extend the Visual
area, but instead take the highlighted text and search for that: >
	:vmap / y/<C-R>"<CR>
(In the <> notation |<>|, when typing it you should type it literally; you
need to remove the 'B' flag from 'cpoptions'.)

If you want to give a register name using the """ command, do this just before
typing the operator character: "v{move-around}"xd".

If you want to give a count to the command, do this just before typing the
operator character: "v{move-around}3>" (move lines 3 indents to the right).

							*{move-around}*
The {move-around} is any sequence of movement commands.  Note the difference
with {motion}, which is only ONE movement command.

Another way to operate on the Visual area is using the |/\%V| item in a
pattern.  For example, to replace all '(' in the Visual area with '#': >

	:'<,'>s/\%V(/#/g

Note that the "'<,'>" will appear automatically when you press ":" in Visual
mode.

==============================================================================
5. Blockwise operators					*blockwise-operators*

Reminder: Use 'virtualedit' to be able to select blocks that start or end
after the end of a line or halfway through a tab.

Visual-block Insert						*v_b_I*
With a blockwise selection, I{string}<ESC> will insert {string} at the start
of block on every line of the block, provided that the line extends into the
block.  Thus lines that are short will remain unmodified.  TABs are split to
retain visual columns.  Works only for adding text to a line, not for
deletions.  See |v_b_I_example|.

Visual-block Append						*v_b_A*
With a blockwise selection, A{string}<ESC> will append {string} to the end of
block on every line of the block.  There is some differing behavior where the
block RHS is not straight, due to different line lengths:

1. Block was created with <C-v>$
    In this case the string is appended to the

Title: Visual Mode: Operators, Objects, Commands, and Blockwise Operations
Summary
This section details the operators (like ~, d, c, y, >, <, !, =, gq), objects (like aw, iw, aW, iW, as, is, ap, ip, ab, ib, aB, iB, at, it, a<, i<, a[, i[, a\", i\", a\', i\', a`, i`), and commands (like :, r, s, C, S, R, x, D, X, Y, p, P, J, U, u, ^], I, A) available in Vim's Visual mode. It also explains how to use registers and counts with operators and mentions the use of /\%V for pattern matching within the Visual area. The section also covers blockwise operations, including inserting text at the start (I) or appending text to the end (A) of a block selection.