Thursday, June 24, 2010

Re: How to jump from to the begin or the end of a python function (or method)

On 06/24/2010 09:11 AM, Peng Yu wrote:
>
>
> On Jun 23, 9:36 pm, AK <andrei....@gmail.com> wrote:
>> On 06/23/2010 10:31 PM, Peng Yu wrote:
>>
>>> In other language that use braces (like C++), it is easier to jump to
>>> the begin and the end of a function or a class. But python don't use
>>> them. Is there a way to jump to the begin and the end of a python
>>> function, class or member method?
>>
>> I use /^\s*def\s\|^\s*class\s.
>
> What about the end of a class, a function or a method?
>


Well, generally you'll have another one beginning after the end, so you
can make a mapping that does this search and then searches back for a
non-blank line: ?[a-zA-Z0-9]+ . If you have hlsearch on, the mapping
should then do ':nohl'.

   -ak

--
 Python plugins for vim: outliner, todo list, project manager, calendar,
 expenses tracker, sortable table, and more |
 http://lightbird.net/pysuite/


No comments:

Post a Comment