occurs and
insert mode does not start (this is Vi compatible).
When 'cpoptions' does not include the 'E' flag, the
"c" command always starts insert mode, even if there
is no text to delete.
*cc*
["x]cc Delete [count] lines [into register x] and start
insert |linewise|. If 'autoindent' is on, preserve
the indent of the first line.
*C*
["x]C Delete from the cursor position to the end of the
line and [count]-1 more lines [into register x], and
start insert. Synonym for c$ (not |linewise|).
*s*
["x]s Delete [count] characters [into register x] and start
insert (s stands for Substitute). Synonym for "cl"
(not |linewise|).
*S*
["x]S Delete [count] lines [into register x] and start
insert. Synonym for "cc" |linewise|.
{Visual}["x]c or *v_c* *v_s*
{Visual}["x]s Delete the highlighted text [into register x] and
start insert (for {Visual} see |Visual-mode|).
*v_r*
{Visual}r{char} Replace all selected characters by {char}.
CTRL-C will be inserted literally.
*v_C*
{Visual}["x]C Delete the highlighted lines [into register x] and
start insert. In Visual block mode it works
differently |v_b_C|.
*v_S*
{Visual}["x]S Delete the highlighted lines [into register x] and
start insert (for {Visual} see |Visual-mode|).
*v_R*
{Visual}["x]R Currently just like {Visual}["x]S. In a next version
it might work differently.
Notes:
- You can end Insert and Replace mode with <Esc>.
- See the section "Insert and Replace mode" |mode-ins-repl| for the other
special characters in these modes.
- The effect of [count] takes place after Vim exits Insert or Replace mode.
- When the 'cpoptions' option contains '$' and the change is within one line,
Vim continues to show the text to be deleted and puts a '$' at the last
deleted character.
See |registers| for an explanation of registers.
Replace mode is just like Insert mode, except that every character you enter
deletes one character. If you reach the end of a line, Vim appends any
further characters (just like Insert mode). In Replace mode, the backspace
key restores the original text (if there was any). (See section "Insert and
Replace mode" |mode-ins-repl|).
*cw* *cW*
Special case: When the cursor is in a word, "cw" and "cW" do not include the
white space after a word, they only change up to the end of the word. This is
because Vim interprets "cw" as change-word, and a word does not include the
following white space.
If you prefer "cw" to include the space after a word, use this mapping: >
:map cw dwi
Or use "caw" (see |aw|).
*:c* *:ch* *:change*
:{range}c[hange][!] Replace lines of text with some different text.
Type a line containing only "." to stop replacing.
Without {range}, this command changes only the current
line.
Adding [!] toggles 'autoindent' for the time this
command is executed.
==============================================================================
3. Simple changes *simple-change* *changing*
*r*
r{char} Replace the character under the cursor with {char}.
If {char} is a <CR> or <NL>, a line break replaces the
character. To replace with a real <CR>, use CTRL-V
<CR>. CTRL-V <NL> replaces with a <Nul>.
If {char} is CTRL-E or CTRL-Y the character from the
line below or above is used, just like with |i_CTRL-E|
and |i_CTRL-Y|. This also works with a count, thus
`10r<C-E>` copies 10 characters from the line below.
If you give a [count], Vim replaces [count] characters
with [count] {char}s. When {char} is a <CR> or <NL>,
however, Vim inserts only one <CR>: "5r<CR>" replaces
five characters with a single line break.
When {char} is a <CR> or <NL>, Vim performs
autoindenting. This works just like deleting the
characters that are replaced and then doing
"i<CR><Esc>".
{char} can be entered as a digraph |digraph-arg|.
|:lmap| mappings apply to {char}. The CTRL-^