sponsor Vim development Vim logo Vim Book Ad

matchparen++ : Improvement over standard matchparen plugin

 script karma  Rating 44/20, Downloaded by 2328  Comments, bugs, improvements  Vim wiki

created by
erik falor
 
script type
utility
 
description
Improves over standard matchparen.vim plugin by echoing line containing matching bracket in the status line so you can quickly see which block is terminated by this paren.  Also scans for braces/parens which are off-screen.

If you write functions or blocks like this:
if (condition)
{
    ...
}
the plugin will echo the line "if (condition)" and not the lone "{".
By default, the plugin scans the line containing the opening brace and the two lines above that, looking for the statement that begins the block, be it a loop or function definition.  If you want more or less, set it in the variable g:MP_stmt_thresh.
 
install details
Copy file to $HOME/.vim/plugin or $HOME/vimfiles/plugin.  Since your local plugins directory is searched before the one in $VIM, it will disable loading of the standard matchparen.vim plugin.  If you install it somewhere else, the standard plugin could be found before this one and be loaded instead.
 

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
matchparen++.vim 1.0.3 2018-07-09 7.0 erik falor Ingo Karkat has pointed out a bug brought about by Vim 8.1.0112:                                            
  "Recent Vim versions have tightened the accepted arguments for searchpair[pos]()
  The fix (also taken from the latest matchparen.vim) is easy: Pass a String-type "0" instead of the number 0 in s_skip"
matchparen++.vim 1.0.2 2008-04-10 7.0 erik falor DoMatchParen command re-loads this plugin instead of matchparen.vim.
Thanks to James Marshall for this idea.
matchparen++.vim 1.0.1 2008-03-19 7.0 erik falor Using timeout feature of searchpairpos() to avoid a long delay while
finding a matching paren.  Borrowed from Bram's patch #7.1.269.
Also accommodates Vim users who don't have the latest patches compiled.
matchparen++.vim 0.1.99 2007-11-05 7.0 erik falor Using Bram's matchparen.vim plugin from standard distribution as starting point for this version.  
                                                                                
Print line containing matching brace with echo instead of echomsg so as to not fill message history with non-message items.
                                                                                
Truncate matching brace line when it's gonna be too long - this avoids the dreaded "Press ENTER or type command to continue" message that would be so disruptive to workflow.
                                                                                
To do this, the plugin must take the &showcmd, &ruler and &laststatus options into consideration.  If you use a custom &rulerformat, you will want to set the global variable g:MP_rulerwidth to the width of your ruler.
                                                                                
The variable g:MP_stmt_thresh lets the user specify how far back the plugin may scan for a statement beginning a code block.
matchparen++.vim 0.1 2007-11-01 7.0 erik falor Initial upload
ip used for rating: 35.172.193.238

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.
   
Vim at Github