Wednesday, January 11, 2023

Re: vim9 autoload script modified : How to reload it On-The-Fly

Hum, thanks a lot Life, after one more check:

./vimfiles/plugged/foo-helper.vim/autoload/vim9fooscript.vim

vim9script

# some many defs func

export def  High_Caller(): void
   Sub_Called(4)
enddef  

def  Sub_Called(code: number ): void
  # some job
enddef  


~/_vimc
import autoload './vimfiles/plugged/foo-helper.vim/autoload/vim9fooscript.vim' as Helper
nnoremap io <Scriptcmd>  Helper.High_Caller()<cr>


typing io it echoes  E1091: Function is not compiled:  vim9fooscript#High_Caller


Does foo-helper.vim directory must match vim9fooscript ?
Le mercredi 11 janvier 2023 à 21:33:08 UTC+1, Lifepillar a écrit :
On 2023-01-11, N i c o l a s <niva...@gmail.com> wrote:
>
> effectively, sourcing does not work sorry lifepillar: it echoes to me a
> message E1091 Function HighCaller (below) is not compiled.
>
> And the calling tree is as this :
> nnoremap *foo *<ScriptCmd> Helper. *HighCaller* ()<CR> ->
> autoload/vim9fooscript.vim :: *exported *def *HighCaller() *->
> autoload/vim9fooscript.vim :: def *SubCalled*

There may be something else going on in your script, possibly a syntax
error in some function. This trivial example works for me:

~/.vim/autoload/vim9fooscript.vim

vim9script

export def HighCaller()
SubCalled()
enddef

def SubCalled()
echo 'I was called!'
enddef

~/.vim/vimrc

import autoload "vim9fooscript.vim" as Helper
nnoremap gG <Scriptcmd> Helper.HighCaller()<cr>

When I start Vim and type gG, Vim echoes 'I was called!'. If I then
change the echo message to something else, save the script and then
:source ~/.vim/autoload/vim9fooscript.vim, I get no errors and gG prints
the updated message.

Life.

--
--
You received this message from the "vim_use" 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_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/876f9f74-0b46-49c3-8352-ea7cfd35d4d1n%40googlegroups.com.

No comments: