in the last line the last time.
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 repeating will
be applied up to the rightmost column of the longest line. Any count passed
to the `.` command is not used.
Visual mode |default-mappings| "@" and "Q" repeat a register for all selected
lines if the selection is linewise. See |v_@-default| and |v_Q-default| for
details. For example, given the text:
123(hello)321
456(world)654
456(NOT THIS)654
With register "x" containing the commands `yi(VP`, visually selecting the
first two lines and typing `@x` produces:
hello
world
456(NOT THIS)654
==============================================================================
7. Examples *visual-examples*
*:visual_example*
Currently the ":" command works on whole lines only. When you select part of
a line, doing something like ":!date" will replace the whole line. If you
want only part of the line to be replaced you will have to make a mapping for
it. In a future release ":" may work on partial lines.
Here is an example, to replace the selected text with the output of "date": >
:vmap _a <Esc>`>a<CR><Esc>`<i<CR><Esc>!!date<CR>kJJ
(In the <> notation |<>|, when typing it you should type it literally; you
need to remove the 'B' flag from 'cpoptions')
What this does is:
<Esc> stop Visual mode
`> go to the end of the Visual area
a<CR><Esc> break the line after the Visual area
`< jump to the start of the Visual area
i<CR><Esc> break the line before the Visual area
!!date<CR> filter the Visual text through date
kJJ Join the lines back together
*visual-search*
Here is an idea for a mapping that makes it possible to do a search for the
selected text: >
:vmap X y/<C-R>"<CR>
(In the <> notation |<>|, when typing it you should type it literally; you
need to remove the 'B' flag from 'cpoptions')
Note that special characters (like '.' and "*") will cause problems.
Visual-block Examples *blockwise-examples*
With the following text, I will indicate the commands to produce the block and
the results below. In all cases, the cursor begins on the 'a' in the first
line of the test text.
The following modeline settings are assumed ":ts=8:sw=4:".
It will be helpful to
:set hls
/<TAB>
where <TAB> is a real TAB. This helps visualise the operations.
The test text is:
abcdefghijklmnopqrstuvwxyz
abc defghijklmnopqrstuvwxyz
abcdef ghi jklmnopqrstuvwxyz
abcdefghijklmnopqrstuvwxyz
1. fo<C-v>3jISTRING<ESC> *v_b_I_example*
abcdefghijklmnSTRINGopqrstuvwxyz
abc STRING defghijklmnopqrstuvwxyz
abcdef ghi STRING jklmnopqrstuvwxyz
abcdefghijklmnSTRINGopqrstuvwxyz
2. fo<C-v>3j$ASTRING<ESC> *v_b_A_example*
abcdefghijklmnopqrstuvwxyzSTRING
abc defghijklmnopqrstuvwxyzSTRING
abcdef ghi jklmnopqrstuvwxyzSTRING
abcdefghijklmnopqrstuvwxyzSTRING
3. fo<C-v>3j3l<.. *v_b_<_example*
abcdefghijklmnopqrstuvwxyz
abc defghijklmnopqrstuvwxyz
abcdef ghi jklmnopqrstuvwxyz
abcdefghijklmnopqrstuvwxyz
4. fo<C-v>3j>.. *v_b_>_example*
abcdefghijklmn opqrstuvwxyz
abc defghijklmnopqrstuvwxyz
abcdef ghi jklmnopqrstuvwxyz
abcdefghijklmn opqrstuvwxyz
5. fo<C-v>5l3jrX *v_b_r_example*
abcdefghijklmnXXXXXXuvwxyz
abc XXXXXXhijklmnopqrstuvwxyz
abcdef ghi XXXXXX jklmnopqrstuvwxyz
abcdefghijklmnXXXXXXuvwxyz
==============================================================================
8. Select mode *Select* *Select-mode*
Select mode looks like Visual mode, but the commands accepted are quite
different. This resembles the selection mode in Microsoft Windows.
When the 'showmode'