Skip to content

Instantly share code, notes, and snippets.

@rbtnn
Created May 26, 2020 05:58
Show Gist options
  • Save rbtnn/429958688eb29f315e34b28664ab3e01 to your computer and use it in GitHub Desktop.
Save rbtnn/429958688eb29f315e34b28664ab3e01 to your computer and use it in GitHub Desktop.
nrformats-unsigned
diff --git a/src/ops.c b/src/ops.c
index 9ab355596..e720d0f96 100644
--- a/src/ops.c
+++ b/src/ops.c
@@ -2441,6 +2441,7 @@ do_addsub(
int dooct;
int dobin;
int doalp;
+ int douns;
int firstdigit;
int subtract;
int negative = FALSE;
@@ -2456,6 +2457,7 @@ do_addsub(
dooct = (vim_strchr(curbuf->b_p_nf, 'o') != NULL); // "Octal"
dobin = (vim_strchr(curbuf->b_p_nf, 'b') != NULL); // "Bin"
doalp = (vim_strchr(curbuf->b_p_nf, 'p') != NULL); // "alPha"
+ douns = (vim_strchr(curbuf->b_p_nf, 'u') != NULL); // "unsigned"
curwin->w_cursor = *pos;
ptr = ml_get(pos->lnum);
@@ -2569,7 +2571,8 @@ do_addsub(
goto theend;
if (col > pos->col && ptr[col - 1] == '-'
- && (!has_mbyte || !(*mb_head_off)(ptr, ptr + col - 1)))
+ && (!has_mbyte || !(*mb_head_off)(ptr, ptr + col - 1)
+ && !douns))
{
negative = TRUE;
was_positive = FALSE;
@@ -2635,7 +2638,8 @@ do_addsub(
if (col > 0 && ptr[col - 1] == '-'
&& (!has_mbyte ||
!(*mb_head_off)(ptr, ptr + col - 1))
- && !visual)
+ && !visual
+ && !douns)
{
// negative number
--col;
diff --git a/src/optionstr.c b/src/optionstr.c
index ff0186f42..a70d02edc 100644
--- a/src/optionstr.c
+++ b/src/optionstr.c
@@ -21,7 +21,7 @@ static char *(p_bo_values[]) = {"all", "backspace", "cursor", "complete",
"hangul", "insertmode", "lang", "mess",
"showmatch", "operator", "register", "shell",
"spell", "wildmode", NULL};
-static char *(p_nf_values[]) = {"bin", "octal", "hex", "alpha", NULL};
+static char *(p_nf_values[]) = {"bin", "octal", "hex", "alpha", "unsigned", NULL};
static char *(p_ff_values[]) = {FF_UNIX, FF_DOS, FF_MAC, NULL};
#ifdef FEAT_CRYPT
static char *(p_cm_values[]) = {"zip", "blowfish", "blowfish2", NULL};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment