*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 text. If several lines are
highlighted, each one will be incremented by an
additional [count] (so effectively creating a
[count] incrementing sequence).
For Example, if you have this list of numbers:
1. ~
1. ~
1. ~
1. ~
Move to the second "1." and Visually select three
lines, pressing g CTRL-A results in:
1. ~
2. ~
3. ~
4. ~
*CTRL-X*
CTRL-X Subtract [count] from the number or alphabetic
character at or after the cursor.
*v_CTRL-X*
{Visual}CTRL-X Subtract [count] from the number or alphabetic
character in the highlighted text.
*v_g_CTRL-X*
{Visual}g CTRL-X Subtract [count] from the number or alphabetic
character in the highlighted text. If several lines
are highlighted, each value will be decremented by an
additional [count] (so effectively creating a [count]
decrementing sequence).
The CTRL-A and CTRL-X commands work for (signed) decimal numbers, unsigned
binary/octal/hexadecimal numbers and alphabetic characters.
This depends on the 'nrformats' option:
- When 'nrformats' includes "bin", Vim assumes numbers starting with '0b' or
'0B' are binary.
- When 'nrformats' includes "octal", Vim considers numbers starting with a '0'
to be octal, unless the number includes a '8' or '9'. Other numbers are
decimal and may have a preceding minus sign.
If the cursor is on a number, the commands apply to that number; otherwise
Vim uses the number to the right of the cursor.
- When 'nrformats' includes "hex", Vim assumes numbers starting with '0x' or
'0X' are hexadecimal. The case of the rightmost letter in the number
determines the case of the resulting hexadecimal number. If there is no
letter in the current number, Vim uses the previously detected case.
- When 'nrformats' includes "alpha", Vim will change the alphabetic character
under or after the cursor. This is useful to make lists with an alphabetic
index.
For decimals a leading negative sign is considered for incrementing or
decrementing, for binary, octal and hex values, it won't be considered. To
ignore the sign Visually select the number before using CTRL-A or CTRL-X.
For numbers with leading zeros (including all octal and hexadecimal numbers),
Vim preserves the number of characters in the number when possible. CTRL-A on
"0077" results in "0100", CTRL-X on "0x100" results in "0x0ff".
There is one exception: When a number that starts with a zero is found not to
be octal (it contains a '8' or '9'), but 'nrformats' does include "octal",
leading zeros are removed to avoid that the result may be recognized as an
octal number.
Note that when 'nrformats' includes "octal", decimal numbers with leading
zeros cause mistakes, because they can be confused with octal numbers.
Note similarly, when 'nrformats' includes both "bin" and "hex", binary numbers
with a leading '0x' or '0X' can be interpreted as hexadecimal rather than
binary since '0b' are valid hexadecimal digits. CTRL-A on "0x0b11"