:se[t] {option}:{value}
Set string or number option to {value}.
For numeric options the value can be given in decimal,
- hex (preceded with 0x) or octal (preceded with '0')
- (hex and octal are only available for machines which
- have the strtol() function).
+ hex (preceded with 0x) or octal (preceded with '0').
The old value can be inserted by typing 'wildchar' (by
default this is a <Tab> or CTRL-E if 'compatible' is
set). See |cmdline-completion|.
goto skip;
}
}
- /* allow negative numbers (for 'undolevels') */
else if (*arg == '-' || VIM_ISDIGIT(*arg))
{
- i = 0;
- if (*arg == '-')
- i = 1;
-#ifdef HAVE_STRTOL
- value = strtol((char *)arg, NULL, 0);
- if (arg[i] == '0' && TOLOWER_ASC(arg[i + 1]) == 'x')
- i += 2;
-#else
- value = atol((char *)arg);
-#endif
- while (VIM_ISDIGIT(arg[i]))
- ++i;
+ /* Allow negative (for 'undolevels'), octal and
+ * hex numbers. */
+ vim_str2nr(arg, NULL, &i, TRUE, TRUE, &value, NULL);
if (arg[i] != NUL && !vim_iswhite(arg[i]))
{
errmsg = e_invarg;