On Oct 8, 3:21 pm, Luc Hermitte <hermi...@free.fr> wrote:
> "James Kanze" <james.ka...@gmail.com> :

> > I'm currently having to deal with C++ code which uses the
> > following coding conventions:
> > [...]
> > My problem is getting [[ and ]] to advance or go back to the
> > next function (or class); the opening braces aren't always in
> > column 1; [...] I rather suspect that some parsing of the C++
> > itself will be necessary.
> > [...]
> > Does anyone know of any available solution?

> The "simplest" solution will probably consist in assembling a
> regex from all the functions that ctags has seen in the
> current file.

Which will still miss classes, I suppose (but it wouldn't be too
difficult to add "class", "struct" and "union" to the regex).
I'll also have to install ctags, since it's not present on this
machine.

> As unfortunately taglist() does not permit to select tags on
> field values, you may have a grep the relevant tags file in
> search of expand('%:t'), keep only the search commands, join
> them in a search pattern with \|, and finally search for the
> newly built pattern.

> Another way will consist in parsing the code in search of
> (surrounding) pairs of brackets. A solution should possible
> for simple cases, but I'm afraid it won't be perfect.

I've enough experience with the issues that I could hack up a
quick parser in C++ which would return the correct position.
The only question then is how to get vim to use it.  The idea,
basically, would be to invoke the program with the current
line number as a parameter, and the buffer on standard in, let
it do the search, and output the target line number.  But how to
integrate this into vim?

--
James Kanze

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply via email to