Mercurial > vim
comparison runtime/doc/map.txt @ 21594:5daca8504c63 v8.2.1347
patch 8.2.1347: cannot easily get the script ID
Commit: https://github.com/vim/vim/commit/909443028b57d7514ce3c71f00e9d808f2126b4f
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Aug 1 20:45:11 2020 +0200
patch 8.2.1347: cannot easily get the script ID
Problem: Cannot easily get the script ID.
Solution: Support expand('<SID>').
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 01 Aug 2020 21:00:04 +0200 |
parents | 3a1ed539ae2a |
children | 1b345fb68ae3 |
comparison
equal
deleted
inserted
replaced
21593:6015f5f423ba | 21594:5daca8504c63 |
---|---|
1164 used. | 1164 used. |
1165 | 1165 |
1166 When executing an autocommand or a user command, it will run in the context of | 1166 When executing an autocommand or a user command, it will run in the context of |
1167 the script it was defined in. This makes it possible that the command calls a | 1167 the script it was defined in. This makes it possible that the command calls a |
1168 local function or uses a local mapping. | 1168 local function or uses a local mapping. |
1169 | |
1170 In case the value is used in a context where <SID> cannot be correctly | |
1171 expanded, use the expand() function: > | |
1172 let &includexpr = expand('<SID>') .. 'My_includeexpr()' | |
1169 | 1173 |
1170 Otherwise, using "<SID>" outside of a script context is an error. | 1174 Otherwise, using "<SID>" outside of a script context is an error. |
1171 | 1175 |
1172 If you need to get the script number to use in a complicated script, you can | 1176 If you need to get the script number to use in a complicated script, you can |
1173 use this function: > | 1177 use this function: > |