diff src/ex_docmd.c @ 24533:9c404d78d767 v8.2.2806

patch 8.2.2806: Vim9: using "++nr" as a command might not work Commit: https://github.com/vim/vim/commit/bdc0f1c6986e5d64f647e0924a4de795b47c549a Author: Bram Moolenaar <Bram@vim.org> Date: Sat Apr 24 19:08:24 2021 +0200 patch 8.2.2806: Vim9: using "++nr" as a command might not work Problem: Vim9: using "++nr" as a command might not work. Solution: Do not recognize "++" and "--" in a following line as addition or subtraction.
author Bram Moolenaar <Bram@vim.org>
date Sat, 24 Apr 2021 19:15:04 +0200
parents 3bfec39ce31c
children f522ef9e5ea3
line wrap: on
line diff
--- a/src/ex_docmd.c
+++ b/src/ex_docmd.c
@@ -3531,6 +3531,13 @@ find_ex_command(
 	    eap->cmdidx = CMD_eval;
 	    return eap->cmd;
 	}
+
+	// Check for "++nr" and "--nr".
+	if (p == eap->cmd && p[0] == p[1] && (*p == '+' || *p == '-'))
+	{
+	    eap->cmdidx = *p == '+' ? CMD_increment : CMD_decrement;
+	    return eap->cmd + 2;
+	}
     }
 #endif