On 03/07/10 14:16, AK wrote:
On 07/03/2010 07:05 AM, KKde wrote:
Hi folks,
In one of my vim script, I have to determine the line no of opening
parenthesis of a C function.
For example consider the following sample text
int foo(a,
b,
c,
d);
//cursor position.
{
....
}
Let's say the cursor is at position as marked in the above text. I
execute the following code in vim script, it works fine, but it takes
around 6-7 seconds to find the opening parenthesis of a function.
let line=1
while ( line != 0)
let line = searchpair('(', '', ')', 'bW',
'synIDattr(synID(line("."), col("."), 1), "name") =~ "cComment"')
endwhile
I like to know is there any other faster alternative to find the line
no of opening parenthesis of a function in vim script?
Did you try the normal % command? -ak
Yes, and if it mixed parentheses inside comments and out of them, did
you try installing matchit?
see :help matchit-install
Best regards,
Tony.
--
TALL KNIGHT: We are now no longer the Knights Who Say Ni!
ONE KNIGHT: Ni!
OTHERS: Sh!
ONE KNIGHT: (wispers) Sorry.
"Monty Python and the Holy Grail" PYTHON (MONTY)
PICTURES LTD
--
You received this message from the "vim_use" 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