Wednesday, June 23, 2010

Re: Performance issues when script does not prevent reloading

On Jun 23, 1:21 pm, AK <andrei....@gmail.com> wrote:
> > 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.
>
> I am defining some buffer mappings using :nnoremap <buffer> ... and that
> seems to work as expected so far.
>

If you're defining buffer-local mappings...then I assume this script
is meant to be filetype-specific (an ftplugin script)? ftplugin
scripts get sourced every time a buffer gets assigned the associated
file type.

If this is NOT an ftplugin script, but is rather a real plugin that
gets loaded on Vim startup (and, I believe you are correct, only on
Vim startup, unless you source it again manually later), then using
<buffer> mappings is probably a bad idea. These mappings will only
ever exist for the first buffer created in Vim, they will not be
available in any other buffers.

If you ARE making an ftplugin, then a b:variable is probably the way
to go after all. And, it should go in ~/.vim/ftplugin, not in ~/.vim/
plugin.

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