On Jul 25, 7:23 am, Reckoner <[email protected]> wrote:
> When editing Python files, I have a hard time keeping track of the
> class in which I am changes. This is because the class definition is
> somewhere way up there in the file that I have scrolled past.
>
> Anybody have any advice for dealing with this? I am currently just
> splitting the current file into two windows so I can keep track of the
> class definition in one window. It's ugly, but it works.
>
Personally, I find having lots of classes in one source file ugly. But
I sympathise, we can't always edit the code we're reading.


> I'm sure somebody has done something better, however.
>
I'm not sure about 'better', but the following mapping should help
you:

:nmap <Leader>c  :?^\s*class? mark c\| echo getline("'c")<cr>

This will search back to the last class definition, mark it with 'c,
and echo that line at the bottom of the window without changing your
current cursor position.


> Any advice appreciated.
>
See the following help for a fuller explanation:

:he :nmap
:he <Leader>
:he :?
:he mark
:he echo
:he getline


> Thanks in advance.
>
Hope this helps;


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

Reply via email to