Friday, August 18, 2017

Re: source or load an autoload script

Hi,

> > I've written more on the subject on SO:
> > https://stackoverflow.com/questions/40254993/how-to-unload-a-vim-script-after-sourcing-it-and-making-changes-to-it/40257268#40257268
> >
> Ok Luc, Vimscript modified as described.
>
> Than when I launch :w! | so% | MK, nothing is took on the fly.
>
> I modify maxTimes allowed to attempt some jobs in my script but
> passing it from 20 to 15 let show 20 after launch.

A few:
- you've forgotten the `dict` attribute
- if your version of vim is to old, `function('s:funcname')` won't work.
- you still have a useless and undesired anti-reinclusion guard in your autoload plugin

BTW, if you wish to add methods to an object that already exists, they'll have to be injected on a reference of the object as you won't execute whatever#new() on an object that already exists. That's the reason behind by lh#object#inject_method(): https://github.com/LucHermitte/lh-vim-lib/blob/master/autoload/lh/object.vim#L96

Here is a patched, and untested, version of your file.


--
Luc Hermitte

--
--
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.
For more options, visit https://groups.google.com/d/optout.

No comments: