Enabling folding in Vim, especially for Ruby

I was originally going to release my .vimrc on the blog, but I’m in the process of repairing it up right now–so it might just confuse people. I will release it at a later time when it is stable(I cleaned it up to get rid of a problem I was having after creaing the ShowMeDo videos, in which i inadvertently destroyed the folding setup). Meanwhile, most of my file is derived from Amir Salihafendic’s vimrc file, available here.

A couple of things I changed from his suggestions:

  1. (Mac OS X only) I put the helper directory contents directly in the Vim.app package contents
  2. (possibly Mac OS X only)I turned off lazy redraw

Meanwhile, I was able to recover most of my folding stuff with the following commands. here is how folding should work(put this in your .vimrc–without the numbers of course):

  1. set foldenable
  2. set foldmethod=indent
  3. set foldlevel=1

That last line depends on your shiftwidth, which you can set by set shiftwidth=2, for example. For a shiftwidth of 2, set foldlevel=1 seems to work fine. Also, for some reason, even though I enabled folding with the first command above, I still have to type in zC in command mode to see the folding.

Hope this helps.

Advertisements

2 responses to “Enabling folding in Vim, especially for Ruby

  1. You broke Amir’s site. The link doesn’t work.

    Thanks for the post.

  2. Thanks for the heads up. I think it was a temporary problem with Amir’s server–I tried the unmodified link now and there is a post on his blog explaining the server downtime. What I will do in the future is to actually make the URL visible in the link.
    Thanks for the feedback,
    Chinmoy

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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