Wednesday, January 11, 2023

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

On 2023-01-11, N i c o l a s <nivaemail@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/tpn6dm%24u3j%241%40ciao.gmane.io.

No comments: