Wednesday, June 23, 2010

Re: Performance issues when script does not prevent reloading

On Jun 23, 11:30 am, AK <andrei....@gmail.com> wrote:
>
> It does work here, vim7.2, ubuntu 9.10. If I add the inputdialog after
> the if block, and source the file, it doesn't show up. If I do :unlet
> b:script_loaded and then source again, it does show up. If I source yet
> again, it stops showing up.

Yes, but if you just enter the ":new" command to open a new buffer,
your script will load.

b:... variables are local to the buffer. Creating a new buffer will
mean that the b:... variable you defined will not exist in the new
buffer and your script will potentially load again.

I'm a little worried that you're developing a plugin without basic
knowledge of variable scope in Vim.
I highly suggest reading through :help internal-variables before you
go any further in your plugin development.

Unless, of course, you're intentionally defining a buch of BUFFER-
LOCAL mappings, commands, etc. in which case you would want to use a
buffer-local variable to determine whether the script is loaded.

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

No comments: