Hi, On Tue, Aug 23, 2022 at 10:05 AM '[email protected]' via vim_dev <[email protected]> wrote: > > @yegappanl > > The only command I see I can prefix with "vim9cmd" is "call SSS()" (the > others already are vim9 functions), to become "vim9cmd SSS()". > This however gives me error "E117: unknown function SSS" (instead of "III"). >
I was not clear in my earlier reply. You need to prefix the "source" command with "vim9cmd" and not the functions defined in the file. When Vim sources a file, it needs a way to determine whether to parse the file as a legacy Vim script or as a Vim9 script. If the first command in the file is "vim9script", then Vim parses the file as a Vim 9 script. Otherwise it parses the file as a legacy script. In your case, since the file doesn't start with the vim9script command, you need to use the ":vim9cmd" prefix to the "source" command to force Vim to parse the file as a Vim9 script. - Yegappan > Prefixing the vim9(!) function III with "vim9cmd" actually works but makes - > from my point of view - no sense at all (why would I need to flag a vim9 > function as vim9 function if that's clear from its definition?) > > Can you (or anybody) shed some light on this? > > Info: I'm using the 9.0.242 > > On Tuesday, August 23, 2022 at 6:25:51 PM UTC+2 [email protected] wrote: >> >> Hi, >> >> You need to prefix the command with ":vim9cmd" >> >> - Yegappan >> >> On Tue, Aug 23, 2022 at 9:18 AM '[email protected]' via vim_dev >> <[email protected]> wrote: >> > >> > The below script, when executed with "so %", gives error "E117: unknown >> > function III". >> > Is there any way to remedy this (given that the same script, running as >> > "vim9script" runs w/o error)? >> > As a side note: the functions below are part of my .vimrc; so I'm having >> > trouble flagging the whole file as "vim9script"... >> > ======================= >> > def III(hx: string): string >> > return hx >> > enddef >> > >> > def DDD(hx: string): string >> > return hx >> > enddef >> > >> > def SSS() >> > echo III("HALA") >> > echo DDD("HULU") >> > enddef >> > >> > call SSS() >> > ======================= >> > >> > -- >> > -- >> > 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 >> > >> > --- >> > You received this message because you are subscribed to the Google Groups >> > "vim_dev" group. >> > To unsubscribe from this group and stop receiving emails from it, send an >> > email to [email protected]. >> > To view this discussion on the web visit >> > https://groups.google.com/d/msgid/vim_dev/5d99e83d-eef6-40c0-b878-03d2012b638an%40googlegroups.com. > > -- > -- > 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 > > --- > You received this message because you are subscribed to the Google Groups > "vim_dev" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/vim_dev/b95eb6c6-f509-44ee-a1ac-a209306a52dfn%40googlegroups.com. -- -- 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 --- You received this message because you are subscribed to the Google Groups "vim_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/vim_dev/CAAW7x7mtuGq5z3vtBm%3DJJA8%2BOOJnYscH7Kh6rQ7pQXfBXBxYfg%40mail.gmail.com.
