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.
If I define all my functions locally inside a class, e.g.:
class CFoo
{
void foo(double d)
{
for (int i(0); i < 10; ++i)
if (true)
double dd = 0;
else
{
int x = 0;
char s = 'a';
}
}
};
then the motion commands work as I expect and as the help in
motion.txt describes. If however, I do as I normally do and declare
the methods in a .h file and have the method definitions in a .cpp
file, e.g.:
void foo(double d)
{
for (int i(0); i < 10; ++i)
if (true)
double dd = 0;
else
{
int x = 0;
char s = 'a';
}
}
and I position the cursor inside the "else" block, then "[m" goes to
the opening brace immediately above the cursor below the else, not to
the "previous start of a method" (the opening brace below the function
name) as it would if the function was inside a class definition. The
other motion commands do similar things, jumping to a different
location to where I need. Is there any analogy to these motion
commands that would suit my needs, either natively in vi or in a
plugin?
Thanks in advance,
Toby
--
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:
Post a Comment