Monday, August 22, 2011

Re: motion.txt suggested mappings for [[, ][, ]] and []

Tim,

Thanks for your clear explanation.

In 'motion.txt', I read:

> The "]" and "[" commands stop at the '{' or '}' in the first column. This is
> useful to find the start or end of a function in a C program.

And that is exactly what I would like to do. Follows a little dummy c# class to
clarify my point. I would like to go to the start of each of the four methods
hereafter. I've used the mappings on this demo class in a separate file, to
avoid interaction with the '{' and '}' characters in this descriptive text.

namespace mySpace
{
class myClass
{
public void someMethod()
{
// bla bla bla
}

public void otherMethod()
{
// tra la le, tra la la
}

public static void staticMethod()
{
// static stuff
}

public void lastMethod()
{
// that's it!
}
}
}

The [[ and ]] maps: they always land the cursor on the namespace bracket.

The ][ and [] maps always put the cursor on the last bracket of the class.

Not in the least thanks to your explanation, I understand that these mappings
would work perfectly if the methods where not nested within a class declaration
nested within a namespace. They will never work to jump to methods nested
inside a one- or two-level outer structure. Too bad.

But it was very educational. Thanks Tim.


Guivho

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