patch 8.2.1347: cannot easily get the script ID
Problem: Cannot easily get the script ID.
Solution: Support expand('<SID>').
diff --git a/src/ex_docmd.c b/src/ex_docmd.c
index 7f9d716..1f36bf7 100644
--- a/src/ex_docmd.c
+++ b/src/ex_docmd.c
@@ -8302,9 +8302,11 @@
#define SPEC_AMATCH (SPEC_ABUF + 1)
"<sflnum>", // script file line number
#define SPEC_SFLNUM (SPEC_AMATCH + 1)
+ "<SID>", // script ID: <SNR>123_
+#define SPEC_SID (SPEC_SFLNUM + 1)
#ifdef FEAT_CLIENTSERVER
"<client>"
-# define SPEC_CLIENT (SPEC_SFLNUM + 1)
+# define SPEC_CLIENT (SPEC_SID + 1)
#endif
};
@@ -8581,6 +8583,16 @@
break;
#endif
+ case SPEC_SID:
+ if (current_sctx.sc_sid <= 0)
+ {
+ *errormsg = _(e_usingsid);
+ return NULL;
+ }
+ sprintf((char *)strbuf, "<SNR>%d_", current_sctx.sc_sid);
+ result = strbuf;
+ break;
+
#ifdef FEAT_CLIENTSERVER
case SPEC_CLIENT: // Source of last submitted input
sprintf((char *)strbuf, PRINTF_HEX_LONG_U,