Friday, July 8, 2011

Re: Go to start/end of a method in C++?

----- "Luc Hermitte" wrote :

> ----- "Toby Walsh" wrote :
>
> > First post to the list so be easy on me. I'm trying to write some
> > functions to automate my commenting process in C++. Reading the
> > help, I would like to use the motion commands ]m, ]M, [m and/or
> > [M for jumping around to starts and ends of function definitions.
>
> The easiest way is to play with a ctags base that uses line numbers.
> That's what I use in my refactoring plugin to identify the begin/end
> of functions.
> [...]

As I have been missing these four [m, ]m, [M and ]M to find method only, for quite some time now, I've just implemented them.

http://code.google.com/p/lh-vim/source/browse/cpp/trunk/ftplugin/c/c_navigate_functions.vim

This will require lh-dev and lh-tag, and lh-vim-lib.
If you don't want the whole lh-cpp package, you can install lh-dev via vim-addon-manager (which will install lh-tag and lh-vim-lib in turn), and just download the new ftplugin.


NB: regarding your need, you'd better play lh#dev#star_tag_session() + filter (see lh-dev functions) to obtain the list of functions in your file, and their respective line numbers -- and pass them to the signature analyser: lh#dev#function#*()

--
Luc Hermitte
http://lh-vim.googlecode.com/
http://hermitte.free.fr/vim/

--
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

No comments: