Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>If I understand correctly and you are trying to look at non-matching parenthesis in C code (that was generated in python), I would recommend you install rainbow.vim from <a href="http://www.drchip.org/astronaut/vim/#RAINBOW" rel="nofollow noreferrer">Dr Chip's Site</a>. This will highlight braces in different colours depending on the levels of indentation and will highlight unmatching braces in red as you have requested. A screenshot <a href="http://img294.imageshack.us/img294/8586/rainbow.jpg" rel="nofollow noreferrer" title="Rainbow Brace Error">http://img294.imageshack.us/img294/8586/rainbow.jpg http://img294.imageshack.us/img294/8586/rainbow.jpg</a></p> <p>To install, download <strong><code>rainbow.vim</code></strong> and place in <code>vimfiles/after/syntax/c/</code> (create this directory if it is not present).</p> <p>On Linux, this will be <code>~/.vim/after/syntax/c/rainbow.vim</code></p> <p>On Windows, it may be <code>c:\vim\vimfiles\after\syntax\c\rainbow.vim</code> or possibly somewhere else, see <code>:help runtimepath</code>.</p> <p>Note that there are some plugins that conflict with <code>rainbow.vim</code>, but it's not too hard to make them co-operate.</p> <p>If you are trying to highlight non-matching parenthesis in the python code, you could modify rainbow.vim to use the python syntax clusters instead of the C ones, but this is a little more involved, but you could use something along the lines of (modified version of Dr Chip's rainbow code):</p> <pre><code>syn cluster pyParenGroup contains=pythonString,pythonRawString,pythonEscape,pythonNumber,pythonBuiltin,pythonException syn match pyParenError display ')' syn region pyParen transparent matchgroup=hlLevel0 start='(' end=')' contains=@pyParenGroup,pyParen1 syn region pyParen1 transparent matchgroup=hlLevel1 start='(' end=')' contains=@pyParenGroup,pyParen2 syn region pyParen2 transparent matchgroup=hlLevel2 start='(' end=')' contains=@pyParenGroup,pyParen3 syn region pyParen3 transparent matchgroup=hlLevel3 start='(' end=')' contains=@pyParenGroup,pyParen4 syn region pyParen4 transparent matchgroup=hlLevel4 start='(' end=')' contains=@pyParenGroup,pyParen5 syn region pyParen5 transparent matchgroup=hlLevel5 start='(' end=')' contains=@pyParenGroup,pyParen6 syn region pyParen6 transparent matchgroup=hlLevel6 start='(' end=')' contains=@pyParenGroup,pyParen7 syn region pyParen7 transparent matchgroup=hlLevel7 start='(' end=')' contains=@pyParenGroup,pyParen8 syn region pyParen8 transparent matchgroup=hlLevel8 start='(' end=')' contains=@pyParenGroup,pyParen9 syn region pyParen9 transparent matchgroup=hlLevel9 start='(' end=')' contains=@pyParenGroup,pyParen hi link pyParenError Error if &amp;bg == "dark" hi default hlLevel0 ctermfg=red guifg=red1 hi default hlLevel1 ctermfg=yellow guifg=orange1 hi default hlLevel2 ctermfg=green guifg=yellow1 hi default hlLevel3 ctermfg=cyan guifg=greenyellow hi default hlLevel4 ctermfg=magenta guifg=green1 hi default hlLevel5 ctermfg=red guifg=springgreen1 hi default hlLevel6 ctermfg=yellow guifg=cyan1 hi default hlLevel7 ctermfg=green guifg=slateblue1 hi default hlLevel8 ctermfg=cyan guifg=magenta1 hi default hlLevel9 ctermfg=magenta guifg=purple1 else hi default hlLevel0 ctermfg=red guifg=red3 hi default hlLevel1 ctermfg=darkyellow guifg=orangered3 hi default hlLevel2 ctermfg=darkgreen guifg=orange2 hi default hlLevel3 ctermfg=blue guifg=yellow3 hi default hlLevel4 ctermfg=darkmagenta guifg=olivedrab4 hi default hlLevel5 ctermfg=red guifg=green4 hi default hlLevel6 ctermfg=darkyellow guifg=paleturquoise3 hi default hlLevel7 ctermfg=darkgreen guifg=deepskyblue4 hi default hlLevel8 ctermfg=blue guifg=darkslateblue hi default hlLevel9 ctermfg=darkmagenta guifg=darkviolet endif </code></pre> <p>EDIT:</p> <p>As a test, I downloaded <strong>gvim70.zip</strong> and <strong>vim70rt.zip</strong> from <a href="ftp://ftp.vim.org/pub/vim/pc/" rel="nofollow noreferrer">ftp://ftp.vim.org/pub/vim/pc/</a> (these are the Windows versions of Vim 7.0). I unzipped the two files into a new directory and ran <code>gvim.exe</code> from <code>vim/vim70/gvim.exe</code>. I <strong>do not</strong> have any vim configuration stored in "C:\Documents and Settings", so running this vim is the same as running a 'vanilla' configuration. I then downloaded <code>pyprint.py</code> from <a href="http://www.amk.ca/python/simple/pyprint.html" rel="nofollow noreferrer">amk.ca/python/simple/pyprint.html</a> as a piece of sample code and copied the above code into a file called code.vim. In gVim, I entered <code>:e pyprint.py</code>. It opened in the white-background window, with no syntax highlighting. I then entered <code>:syntax on</code>, which switched the default syntax highlighting on. I added a second <code>)</code> character on line 8. Finally, I entered <code>:source code.vim</code>, which made the second <code>)</code> character be highlighted in red.</p> <p>I've also carried out this test on Linux (with Vim 7.2), by entering the following command sequence:</p> <pre><code>cd ~ mv .vimrc old_dot_vimrc mv .gvimrc old_dot_gvimrc mv .vim old_dot_vim vim pyprint.py :e pyprint.py " Add extra bracket here! :syntax on :source code.vim </code></pre> <p>Again, the second bracket is highlighted and everything else seems normal.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload