Ingo Karkat wrote:
> 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.
Agreed, using a buffer-local variable is better than trying to use a
pattern to match filetypes.
--
hundred-and-one symptoms of being an internet addict:
267. You get an extra phone line so you can get phone calls.
/// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
--
--
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.