Folding in vim
Ron Adam
rrr at ronadam.com
Sun Jul 3 01:40:18 EDT 2005
Terry Hancock wrote:
> My general attitude towards IDEs and editors has been
> extremely conservative, but today I decided to see what
> this "folding" business was all about.
>
> I see that vim (and gvim, which is what I actually use)
> has this feature, and it is fairly nice, but at present it's
> very manual --- and frankly it's hard for me to see the
> point if I have to manually mark folds every time I start
> up.
I been trying to learn and use the 'Cream' distribution of Vim.
http://cream.sourceforge.net/
Playing around with it a bit....
If I highlight any block of code... then press F9 it folds it. Put the
cursor on the fold and pressing F9 again unfolds it. It remembers the
folds, so putting the cursor anywhere in the previous folded area and
pressing F9 again refolds the fold. Folds can be inside of folds.
Saving the file exiting and reopening it... the folded folds remained
folded. I'm not sure where it keeps the fold info for the file.
The folds don't have anything to do with classes or functions, but are
arbitrary selected lines, with the first line displayed after the number
of lines folded. So a whole file gets reduced to...
1 # SliderDialog.py
2
3 +--- 20 lines: """ SIMPLE SLIDER DIALOG -------------------------
23
24 +-- 24 lines: # Imports------------------------------------------
48
49 +-- 13 lines: # Values extracted from win32.com------------------
62
63 +-- 67 lines: class SliderDialog(dialog.Dialog):-----------------
130
131 +-- 4 lines: def GetSliderInput( title, text, label, value=0 ):-
135
136 +-- 17 lines: if __name__ == '__main__':-------------------------
153
Pretty cool, I'll probably use folding more now that I've played with it
a bit.
I like Vim-Cream, but I still haven't gotten the script right for
executing the current file in the shell. And a second script for
executing the current file in the shell and capturing the output in a
pane. I think some of it may be windows path conflicts.
Ron
More information about the Python-list
mailing list