Sunday, March 6, 2011

Re: using the help system in split screen mode

Reply to message «Re: using the help system in split screen mode»,
sent 21:22:05 06 March 2011, Sunday
by Chris Jones:

> ² .. w/o modifying the script, naturally.
Some empirics detecting what variable is used inside a protector (or probably
some code that will remove the differencies between keys(g:), keys(b:), keys(t:)
and keys(w:) before and after plugin was run) + parsing an output of ``:execute
"function /.*"'' seeking for names that start with <SNR>{plugin_sid}_ + **adding
a code that will save `s:' dictionary somewhere so that script-local variables
can be removed** and you will reload plugin correctly.

So, the answer is no, without modification of script it is not possible.

I personally wrote some scripts that can be reloaded by
:LoadCommand reload {plugname}
(for example,
:LoadCommand reload plugin/translit3
) and now is writing a framework that will replace it with
:call frawor#Reload(plugname)
(frawor can reload itself as well, though it will cause all other plugins to be
reloaded too). But all these scripts follow some rules and use my framework
(deprecated vimpluginloader or new frawor that is in alpha stage). If you want
to use frawor, I can help, but plugin API may suffer some changes before I post
it to vim.org.

> While I'm at it.. I had to run a guinea pig Vim session that I could
> easily bounce because I was unable to find a way to make Vim reload the
> script. If you just source xxx.vim.. it sees that the 'load' variable
> exists and exits immediately & you're stuck with the old version.
There is a workaround:
:mksession! ses.vim
:wqa!
%vim -S ses.vim && rm ses.vim # will only remove ses.vim when vim exits

Original message:
> On Sun, Mar 06, 2011 at 12:48:09PM EST, ZyX wrote:
> > Reply to message «Re: using the help system in split screen mode»,
> >
> > sent 20:03:40 06 March 2011, Sunday > by Chris Jones:
> > > setl bt= | execute "vert help " a:s | execute ':redraw!'
> > > ..
> > > setl bt= | execute "help " a:s | execute ':redraw!'
> >
> > Just a minor fix: you don't need a second `execute' here as well as
> >
> > space after the `help':
> > setl bt= | execute "help" a:s | redraw!
> >
> > (or, if you want to add space explicitely: `execute "help ".a:s')
>
> Ah.. indeed. Now that's odd. Since I know nothing about vimscript,
> I tested pretty much everything interactively from Vim's command line..
> and I found I needed the additional space. Can't reproduce.. so you must
> be right about that.¹
>
> While I'm at it.. I had to run a guinea pig Vim session that I could
> easily bounce because I was unable to find a way to make Vim reload the
> script. If you just source xxx.vim.. it sees that the 'load' variable
> exists and exits immediately & you're stuck with the old version.
>
> Is there any way to do that²..?
>
> Thanks,
>
> cj
>
> ¹ Now, I remember hesitating between the simpler form I ended up using
> and explicit concatenation via the '.' operator.. Pretty sure that's
> what it was.
>
> ² .. w/o modifying the script, naturally.

No comments:

Post a Comment