==============================================================================
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-^ command
in Insert mode can be used to switch this on/off
|i_CTRL-^|. See |utf-8-char-arg| about using
composing characters when 'encoding' is Unicode.
*gr*
gr{char} Replace the virtual characters under the cursor with
{char}. This replaces in screen space, not file
space. See |gR| and |Virtual-Replace-mode| for more
details. As with |r| a count may be given.
{char} can be entered like with |r|, but characters
that have a special meaning in Insert mode, such as
most CTRL-keys, cannot be used.
*gr-default*
Nvim creates |lsp-defaults| mappings which may inhibit
the builtin behavior of |gr|. Use this to restore the
builtin behavior: >
nnoremap <nowait> gr gr
<
*digraph-arg*
The argument for Normal mode commands like |r| and |t| is a single character.
When 'cpo' doesn't contain the 'D' flag, this character can also be entered
like |digraphs|. First type CTRL-K and then the two digraph characters.
*case*
The following commands change the case of letters. The currently active
|locale| is used. See |:language|. The LC_CTYPE value matters here.
*~*
~ 'notildeop' option: Switch case of the character
under the cursor and move the cursor to the right.
If a [count] is given, do that many characters.
~{motion} 'tildeop' option: switch case of {motion} text.
*g~*
g~{motion} Switch case of {motion} text.
g~g~ *g~g~* *g~~*
g~~ Switch case of current line.
*v_~*
{Visual}~ Switch case of highlighted text (for {Visual} see
|Visual-mode|).
*v_U*
{Visual}U Make highlighted text uppercase (for {Visual} see
|Visual-mode|).
*gU* *uppercase*
gU{motion} Make {motion} text uppercase.
Example: >
:map! <C-F> <Esc>gUiw`]a
< This works in Insert mode: press CTRL-F to make the
word before the cursor uppercase. Handy to type
words in lowercase and then make them uppercase.
gUgU *gUgU* *gUU*
gUU Make current line uppercase.
*v_u*
{Visual}u Make highlighted text lowercase (for {Visual} see
|Visual-mode|).
*gu* *lowercase*
gu{motion} Make {motion} text lowercase.
gugu *gugu* *guu*
guu Make current line lowercase.
*g?* *rot13*
g?{motion} Rot13 encode {motion} text.
*v_g?*
{Visual}g? Rot13 encode the highlighted text (for {Visual} see
|Visual-mode|).
g?g? *g?g?* *g??*
g?? Rot13 encode current line.
To turn one line into title caps, make every first letter of a word
uppercase: >
:s/\v<(.)(\w*)/\u\1\L\2/g
Adding and subtracting ~
*CTRL-A*
CTRL-A Add [count] to the number or alphabetic character at
or after the cursor.
*v_CTRL-A*
{Visual}CTRL-A Add [count] to the number or alphabetic character in
the highlighted text.
*v_g_CTRL-A*
{Visual}g CTRL-A Add [count] to the number or alphabetic character in
the highlighted