By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
439,941 Members | 1,766 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 439,941 IT Pros & Developers. It's quick & easy.

Folding in vim

P: n/a
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 tried to load a couple of different scripts to
automatically fold Python code in vim, but none of them
seems to do a good job.

The obvious thing (to me) would be for functions and
classes to be folded at the top level, with each method
folded inside the class folds. But I can't seem to figure
out how to make that happen (other than manually,
I mean). Actually, I usually want to fold the comment
block at the top with the license disclaimer and module
documentation, too, but I can do that manually.

I've tried:
python_fold.vim by Jorrit Wiersma
http://www.vim.org/scripts/script.php?script_id=515
and
AutoFold.vim by Dave Vehrs
http://www.vim.org/scripts/script.php?script_id=925

Does anybody have a better suggestion (or perhaps can
tell me how to make one of these do what I'm wanting)?

I'm assuming that I can set these by using the
Tools -> Folding -> Fold Method -> Syntax
(or Expression for python_fold)

but it doesn't seem to work. python_fold seems to just
collapse methods (but not the whole classes they are in),
and I can't seem to make AutoFold do anything at all, so
I must be using it wrong.

--
Terry Hancock ( hancock at anansispaceworks.com )
Anansi Spaceworks http://www.anansispaceworks.com

Jul 19 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.