Closed bfrg closed 2 years ago
Steps to reproduce
The section under
:h vim9-scopes
needs to be updated since it's no longer possible to writedef scriptname#function()
. Doing so gives the error:E1263: cannot use name with # in Vim9 script, use export instead
I'll fix that.
What is the point of keeping the prefix
s:
for functions or variables? I personally don't see an advantage. Removing it (or forcing it) will make all plugins look more consistent.
Yes, we could drop it. The only reason I can think of to keep it is that in a legacy function the s: prefix must be used:
vim9script
def Local()
echo 'local'
enddef
func Legacy()
call s:Local() " won't work without s:
endfunc
Legacy()
There is already an inconsistency in Vim's runtime. See for example
s:LoadFTPlugin()
andSetSyn(name: string)
.
This comes from converting a legacy script to Vim9. So the question is whether it is good to force removing the "s:" prefix or is it more convenient to let it there?
And out of curiosity, why doesn't the file
ftplugin.vim
contain anyvim9script
declaration at the top of the file. The first few lines use the old legacy vimscript syntax, whereas thedef
function the new syntax. In my option, that's a little bit confusing. Why not justvim9script
the entire script? Similar formenu.vim
andsynmenu.vim
.
It's because of the "finish" command. I wasn't quite sure if "vim9script noclear" would work. The "did_load_ftplugin" is cleared in ftplugof.vim. But the function could remain. I'll see if I can make that work.
-- How To Keep A Healthy Level Of Insanity:
Don't use any punctuation marks.
/// Bram Moolenaar -- @.*** -- http://www.Moolenaar.net \\ /// \\ \\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ /// \\ help me help AIDS victims -- http://ICCF-Holland.org ///
Fixed in 9da17d7.
Steps to reproduce
The section under
:h vim9-scopes
needs to be updated since it's no longer possible to writedef scriptname#function()
. Doing so gives the error:What is the point of keeping the prefix
s:
for functions or variables? I personally don't see an advantage. Removing it (or forcing it) will make all plugins look more consistent. There is already an inconsistency in Vim's runtime. See for examples:LoadFTPlugin()
andSetSyn(name: string)
.And out of curiosity, why doesn't the file
ftplugin.vim
contain anyvim9script
declaration at the top of the file. The first few lines use the old legacy vimscript syntax, whereas thedef
function the new syntax. In my option, that's a little bit confusing. Why not justvim9script
the entire script? Similar formenu.vim
andsynmenu.vim
.Version of Vim
8.2.4333