aboutsummaryrefslogtreecommitdiff
path: root/runtime
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2024-07-07 06:32:54 +0800
committerGitHub <noreply@github.com>2024-07-07 06:32:54 +0800
commit5da9b49b19240bb00f338249fef84a2bf1212b49 (patch)
tree07a864275674601b81c5f77927b7f2b8794d8186 /runtime
parent7a54d707fa6f32822b241140b31a348ad5ad0e6b (diff)
downloadrneovim-5da9b49b19240bb00f338249fef84a2bf1212b49.tar.gz
rneovim-5da9b49b19240bb00f338249fef84a2bf1212b49.tar.bz2
rneovim-5da9b49b19240bb00f338249fef84a2bf1212b49.zip
vim-patch:9.1.0537: signed number detection for CTRL-X/A can be improved (#29590)
Problem: signed number detection for CTRL-X/A can be improved (Chris Patuzzo) Solution: Add the new "blank" value for the 'nrformat' setting. This will make Vim assume a signed number only if there is a blank in front of the sign. (distobs) fixes: vim/vim#15033 closes: vim/vim#15110 https://github.com/vim/vim/commit/25ac6d67d92e0adda53b8d44b81c15031643ca1e Co-authored-by: distobs <cuppotatocake@gmail.com>
Diffstat (limited to 'runtime')
-rw-r--r--runtime/doc/options.txt14
-rw-r--r--runtime/lua/vim/_meta/options.lua14
2 files changed, 28 insertions, 0 deletions
diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt
index 70d0bd4369..4bb589fb2c 100644
--- a/runtime/doc/options.txt
+++ b/runtime/doc/options.txt
@@ -4430,6 +4430,20 @@ A jump table for the options with a short description can be found at |Q_op|.
(without "unsigned" it would become "9-2019").
Using CTRL-X on "0" or CTRL-A on "18446744073709551615"
(2^64 - 1) has no effect, overflow is prevented.
+ blank If included, treat numbers as signed or unsigned based on
+ preceding whitespace. If a number with a leading dash has its
+ dash immediately preceded by a non-whitespace character (i.e.,
+ not a tab or a " "), the negative sign won't be considered as
+ part of the number. For example:
+ Using CTRL-A on "14" in "Carbon-14" results in "Carbon-15"
+ (without "blank" it would become "Carbon-13").
+ Using CTRL-X on "8" in "Carbon -8" results in "Carbon -9"
+ (because -8 is preceded by whitespace. If "unsigned" was
+ set, it would result in "Carbon -7").
+ If this format is included, overflow is prevented as if
+ "unsigned" were set. If both this format and "unsigned" are
+ included, "unsigned" will take precedence.
+
Numbers which simply begin with a digit in the range 1-9 are always
considered decimal. This also happens for numbers that are not
recognized as octal or hex.
diff --git a/runtime/lua/vim/_meta/options.lua b/runtime/lua/vim/_meta/options.lua
index fb04da14a5..40c12d94fd 100644
--- a/runtime/lua/vim/_meta/options.lua
+++ b/runtime/lua/vim/_meta/options.lua
@@ -4549,6 +4549,20 @@ vim.go.mouset = vim.go.mousetime
--- (without "unsigned" it would become "9-2019").
--- Using CTRL-X on "0" or CTRL-A on "18446744073709551615"
--- (2^64 - 1) has no effect, overflow is prevented.
+--- blank If included, treat numbers as signed or unsigned based on
+--- preceding whitespace. If a number with a leading dash has its
+--- dash immediately preceded by a non-whitespace character (i.e.,
+--- not a tab or a " "), the negative sign won't be considered as
+--- part of the number. For example:
+--- Using CTRL-A on "14" in "Carbon-14" results in "Carbon-15"
+--- (without "blank" it would become "Carbon-13").
+--- Using CTRL-X on "8" in "Carbon -8" results in "Carbon -9"
+--- (because -8 is preceded by whitespace. If "unsigned" was
+--- set, it would result in "Carbon -7").
+--- If this format is included, overflow is prevented as if
+--- "unsigned" were set. If both this format and "unsigned" are
+--- included, "unsigned" will take precedence.
+---
--- Numbers which simply begin with a digit in the range 1-9 are always
--- considered decimal. This also happens for numbers that are not
--- recognized as octal or hex.