Re: Please help improve this pattern
Dasn wrote: > hi, vimmers. > > I am writing a script in which it attempts to add a breakpoint on > current line if there defines a function. > > " breakadd on current line > let pat = '\v^\s*:?fu(|n|nc|nct|ncti|nctio|nction)\s*!?\s*(\w+)\s*\(.{-}\)' > let m = matchlist(getline('.'), pat) > if len(m) > 3 && m[2] != "" > exe "breakadd func" m[2] > else > echo "No function definition on current line." > endif > > As you can see, the most ugly part is the pattern: > '\v^\s*:?fu(|n|nc|nct|ncti|nctio|nction)\s*!?\s*(\w+)\s*\(.{-}\)' > > Can you please help me to rewrite this pattern, especially the > part matches 'fu[nction]'? Try... :help /\%[] Brett S. > > Thanks. > Please Cc me :) > --~--~-~--~~~---~--~~ You received this message from the "vim_use" maillist. For more information, visit http://www.vim.org/maillist.php -~--~~~~--~~--~--~---
Re: Please help improve this pattern
On Fri, Apr 3, 2009 at 5:49 PM, Dasn wrote: > hi, vimmers. > > I am writing a script in which it attempts to add a breakpoint on > current line if there defines a function. > > " breakadd on current line > let pat = '\v^\s*:?fu(|n|nc|nct|ncti|nctio|nction)\s*!?\s*(\w+)\s*\(.{-}\)' > let m = matchlist(getline('.'), pat) > if len(m) > 3 && m[2] != "" > exe "breakadd func" m[2] > else > echo "No function definition on current line." > endif > > As you can see, the most ugly part is the pattern: > '\v^\s*:?fu(|n|nc|nct|ncti|nctio|nction)\s*!?\s*(\w+)\s*\(.{-}\)' > > Can you please help me to rewrite this pattern, especially the > part matches 'fu[nction]'? \ for the tricky part. See :help /\%[] -- /George V. Reilly geo...@reilly.org http://www.georgevreilly.com/blog http://blogs.cozi.com/tech --~--~-~--~~~---~--~~ You received this message from the "vim_use" maillist. For more information, visit http://www.vim.org/maillist.php -~--~~~~--~~--~--~---
Please help improve this pattern
hi, vimmers. I am writing a script in which it attempts to add a breakpoint on current line if there defines a function. " breakadd on current line let pat = '\v^\s*:?fu(|n|nc|nct|ncti|nctio|nction)\s*!?\s*(\w+)\s*\(.{-}\)' let m = matchlist(getline('.'), pat) if len(m) > 3 && m[2] != "" exe "breakadd func" m[2] else echo "No function definition on current line." endif As you can see, the most ugly part is the pattern: '\v^\s*:?fu(|n|nc|nct|ncti|nctio|nction)\s*!?\s*(\w+)\s*\(.{-}\)' Can you please help me to rewrite this pattern, especially the part matches 'fu[nction]'? Thanks. Please Cc me :) -- Dasn --~--~-~--~~~---~--~~ You received this message from the "vim_use" maillist. For more information, visit http://www.vim.org/maillist.php -~--~~~~--~~--~--~---