Friday, August 18, 2017

Re: source or load an autoload script

De: "Ni Va" <nivaemail@gmail.com>
> OK. My problem is that I don't see effect when I modify a vimscript.
> In the joined screen, you can see two vimscript. The right one is a
> 'class' instanciated in the left one. Then a simple command MK call
> MakeMyVim.
>
> So, if I modify my vimscritp class and launch MK command, I don't see
> effect of my change as if it was not sourced.

That seems normal. trigger#new()['setup'] cannot be updated without calling new() again.
My take on the subject: never define methods this ways. Prefer to define a s:method and bind it in the constructor/creator function with

let new_obj.method_name = function('s:method_implementation')

First it'll allow reloading. But also, it'll improve greatly debugability.

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

BTW, autoload plugins don't need anti-inclusion guards. It makes no sense there.

HTH,

--
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: