On 01-May-2013 22:29 +0200, Bram Moolenaar wrote:
> Fanhe Fanhed wrote:
>
>> matchparen plugin in CursorMoveI autocmd is too slow while typing. So I
>> wish disable it in insert mode.
>
> I suppose this is because the syntax highlighting for the language is
> slow. Disabling it for all file types is a bit of a blunt instrument
> then.
>
> How about allowing the user to specify the filetypes for which
> matchparen works in insert mode? While at it, might as well defined the
> file types for which it works at all.
Such a configuration is not trivial to implement (think of compound
filetypes like "c.doxygen") and still not the most general. If all this
configurability really has to be there, I'd rather have the script
observe both buffer-local or global variables, like:
#v+
autocmd CursorMovedI *
\ if exists('b:matchparen_no_insertmode') |
\ if b:matchparen_no_insertmode |
\ return |
\ endif
\ elseif exists('g:matchparen_no_insertmode') &&
g:matchparen_no_insertmode |
\ return |
\ endif |
\ ...
#v-
This gets you the filetype-specific disabling (in a little more
roundabout way, by setting b:matchparen_no_insertmode in
~/.vim/after/ftplugin/{filetype}.vim), and you can also disable manually
for the current buffer, for all buffers in a particular subdirectory /
of a certain file size / matching a certain pattern / etc.
I use this idiom in a couple of my plugins, and I've found it more
flexible than a list of configurable filetypes.
-- regards, ingo
--
--
You received this message from the "vim_dev" 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_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.