Home Explore Blog CI



neovim

6th chunk of `runtime/doc/change.txt`
be537c4a36255ab333c1e3a75dd83f4dc8be61afe5b340b70000000100000fa1
 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" results in
"0x0b12", not "0x0b100".
When 'nrformats' includes "bin" and doesn't include "hex", CTRL-A on "0b11" in
"0x0b11" results in "0x0b100".

When the number under the cursor is too big to fit into 64 bits, it will be
rounded off to the nearest number that can be represented, and the
addition/subtraction is skipped.  E.g. CTRL-X on 18446744073709551616 results
in 18446744073709551615.  Same for larger numbers, such as 18446744073709551618.

The CTRL-A command is very useful in a macro.  Example: Use the following
steps to make a numbered list.

1. Create the first list entry, make sure it starts with a number.
2. qa	     - start recording into register 'a'
3. Y	     - yank the entry
4. p	     - put a copy of the entry below the first one
5. CTRL-A    - increment the number
6. q	     - stop recording
7. <count>@a - repeat the yank, put and increment <count> times


SHIFTING LINES LEFT OR RIGHT				*shift-left-right*

							*<*
 <{motion}		Shift {motion} lines one 'shiftwidth' leftwards.

			If the 'shiftwidth' option is set to zero, the amount
			of indent is calculated at the first non-blank
			character in the line.
							*<<*
 <<			Shift [count] lines one 'shiftwidth' leftwards.

							*v_<*
{Visual}[count]<	Shift the highlighted lines [count] 'shiftwidth'
			leftwards (for {Visual} see |Visual-mode|).

							*>*
 >{motion}		Shift {motion} lines one 'shiftwidth' rightwards.

			If the 'shiftwidth' option is set to zero, the amount
			of indent is calculated at the first non-blank
			character in the line.
							*>>*
 >>			Shift [count] lines one 'shiftwidth' rightwards.

							*v_>*
{Visual}[count]>	Shift the highlighted lines [count] 'shiftwidth'
			rightwards (for {Visual} see |Visual-mode|).

							*:<*
:[range]<		Shift [range] lines one 'shiftwidth' left.  Repeat '<'
			for shifting multiple 'shiftwidth's.

:[range]< {count}	Shift {count} lines one 'shiftwidth' left, starting
			with [range] (default current line |cmdline-ranges|).
			Repeat '<' for shifting multiple 'shiftwidth's.

:[range]le[ft] [indent]	left align lines in [range].  Sets the indent in the
			lines to [indent] (default 0).

							*:>*
:[range]> [flags]	Shift [range] lines one 'shiftwidth' right.
			Repeat '>' for shifting multiple 'shiftwidth's.
			See |ex-flags| for [flags].

:[range]> {count} [flags]
			Shift {count} lines one 'shiftwidth' right, starting
			with [range] (default current line |cmdline-ranges|).
			Repeat '>' for shifting multiple 'shiftwidth's.
			See |ex-flags| for [flags].

The ">" and "<" commands are handy for changing the indentation within
programs.  Use the 'shiftwidth' option to set the size of the white space
which these commands insert or delete.  Normally the 'shiftwidth' option is 8,
but you can set it to, say, 3 to make smaller indents.  The shift leftwards
stops when there is no indent.  The shift right does not affect empty lines.

If the 'shiftround' option is on, the indent is rounded to a multiple of
'shiftwidth'.

If the

Title: Vim: Number Formatting, Incrementing Large Numbers, and Shifting Lines
Summary
This section discusses how Vim handles numbers with leading zeros and large numbers beyond 64 bits when using CTRL-A and CTRL-X. It provides examples of how 'nrformats' affects the interpretation of binary, octal, and hexadecimal numbers. The section also presents a macro example demonstrating how CTRL-A can be used to create a numbered list. Furthermore, it explains how to shift lines left or right using '<' and '>', detailing the effect of 'shiftwidth' and 'shiftround' options. It includes command-line equivalents for shifting lines and adjusting indentation within a specified range.