0
0
mirror of https://github.com/vim/vim.git synced 2025-09-25 03:54:15 -04:00

patch 8.2.1347: cannot easily get the script ID

Problem:    Cannot easily get the script ID.
Solution:   Support expand('<SID>').
This commit is contained in:
Bram Moolenaar
2020-08-01 20:45:11 +02:00
parent 491799be50
commit 909443028b
4 changed files with 38 additions and 7 deletions

View File

@@ -8302,9 +8302,11 @@ find_cmdline_var(char_u *src, int *usedlen)
#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 @@ eval_vars(
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,