Vim Tip: Folding FTW

I always say methods should have two levels of indentation at most, but even if your code is perfect like mine you may still have to dwell with other people’s code (which, obviously, is ugly code), people how may have lots of fun shaping the program like a pyramid. 0040-teddy-bear-sepuku

Not all is lost, you don’t have to commit sepuku (at least not for this one). Just use Vim’s indent method like this:

:set foldmethod=indent

That should give you a better view of the code flow. As always, use ‘%’ to navigate all those pesky { and }.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s