Loading ...
Sorry, an error occurred while loading the content.

69329[PATCH]Add an option for matchparen to disable it in insert mode

Expand Messages
  • Fanhe Fanhed
    Apr 29, 2013
    • 0 Attachment
      matchparen plugin in CursorMoveI autocmd is too slow while typing. So I wish disable it in insert mode.



      diff -r c61da758a9a2 runtime/doc/pi_paren.txt
      --- a/runtime/doc/pi_paren.txt Wed Apr 24 18:34:45 2013 +0200
      +++ b/runtime/doc/pi_paren.txt Tue Apr 30 12:45:56 2013 +0800
      @@ -15,6 +15,10 @@
       The plugin installs CursorMoved, CursorMovedI and WinEnter autocommands to
       redefine the match highlighting.
       
      +You can disable this plugin in insert mode by setting the "matchparen_noinsert"
      +variable: >
      + :let matchparen_noinsert = 1
      +
        *:NoMatchParen* *:DoMatchParen*
       To disable the plugin after it was loaded use this command: >
       
      diff -r c61da758a9a2 runtime/plugin/matchparen.vim
      --- a/runtime/plugin/matchparen.vim Wed Apr 24 18:34:45 2013 +0200
      +++ b/runtime/plugin/matchparen.vim Tue Apr 30 12:45:56 2013 +0800
      @@ -1,6 +1,6 @@
       " Vim plugin for showing matching parens
       " Maintainer:  Bram Moolenaar <Bram@...>
      -" Last Change: 2013 Mar 19
      +" Last Change: 2013 Apr 30
       
       " Exit quickly when:
       " - this plugin was already loaded (or disabled)
      @@ -13,7 +13,13 @@
       
       augroup matchparen
         " Replace all matchparen autocommands
      -  autocmd! CursorMoved,CursorMovedI,WinEnter * call s:Highlight_Matching_Pair()
      +  autocmd! CursorMoved,WinEnter * call s:Highlight_Matching_Pair()
      +  if exists("g:matchparen_noinsert") && g:matchparen_noinsert
      +    autocmd! InsertEnter * call s:Unhighlight_Matching_Pair()
      +    autocmd! InsertLeave * call s:Highlight_Matching_Pair()
      +  else
      +    autocmd! CursorMovedI * call s:Highlight_Matching_Pair()
      +  endif
         if exists('##TextChanged')
           autocmd! TextChanged,TextChangedI * call s:Highlight_Matching_Pair()
         endif
      @@ -27,6 +33,14 @@
       let s:cpo_save = &cpo
       set cpo-=C
       
      +function! s:Unhighlight_Matching_Pair()
      +  " Remove any previous match.
      +  if exists('w:paren_hl_on') && w:paren_hl_on
      +    3match none
      +    let w:paren_hl_on = 0
      +  endif
      +endfunction
      +
       " The function that is invoked (very often) to define a ":match" highlighting
       " for any matching paren.
       function! s:Highlight_Matching_Pair()



      --
      --
      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 vim_dev+unsubscribe@....
      For more options, visit https://groups.google.com/groups/opt_out.
       
       
    • Show all 19 messages in this topic