Comment #1 on issue 80 by [email protected]: Feature request: variation
for <SID> to return script base name
http://code.google.com/p/vim/issues/detail?id=80
The whole point of <SID> is that the corresponding name is not visible from
outside its defining script. IMHO using what you propose would defeat this
goal. To pass a name visible from outside the script, don't use <SID>, use
<Plug>MyScriptName_ — or even start your function, command, or global
variable name with just MyScriptName_ where MyScriptName is your script's
name and where the underscore is there to prevent name collision with a
different script whose name would start in the same way.
It is possible, however, to determine manually what <SID> means inside a
given script, as follows:
1. Make sure the script has been run at least once in the present Vim
session.
2. Find that script in the output of :scriptnames — the line with that
script's name starts with a number, which is the "script number" of that
script for the duration of the present session.
3. If, for instance, that script's number is 25, then the <SID> of that
script is <SNR>25_ (with the underscore at the end) where <SNR> is a
special code which should not collide with anything that your keyboard can
normally produce.
See ":help <SID>" for a ddetailed discussion. How to find back the current
script's number _in vimscript code_, rather than manually, has been
discussed in the past, and I think that a way of doing it was found, but I
don't remember the details. Maybe they've been written up as an article on
http://vim.wikia.com/ (or maybe not), maybe you could try searching that
wiki.
Best regards,
Tony.
--
There's more than one way to skin a cat:
Way number 27 -- Use an electric sander.
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php