Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm working on a project with a friend soon. Given that he cares about these things more than me, I let him choose the indentation. Him being a Ruby fan, he chose two spaces.

My usual is to use tabs. Is there anyway I can set vim to, only in this specific folder, have it as two spaces when I press the tab button?

share|improve this question
Double spaces? Now I really have heard everything! – Phoshi Feb 13 '10 at 22:07
I thought the meaning was clear. Double spaces = two spaces. Edited anyway... – Macha Feb 13 '10 at 22:08
Oh, no, I understood what you meant, I just didn't think anybody seriously used those over tabs :P – Phoshi Feb 13 '10 at 22:15
@Phoshi: I know. I like tabs, because at the end of the day you can change your editor settings if you are not happy with how wide they are. You can't do that with spaces (any amount) – Macha Feb 13 '10 at 22:16
Sure you can ... vim ... retab ... – Rook Feb 13 '10 at 23:43
up vote 3 down vote accepted

Weeks ago, I was facing the same problem and I found this : Secrets of tabs in vim

As I did for scala, it's easy to adapt this for ruby

vim will also read .vimrc in the current directory (when the exrc option is set in your normal vimrc), which is useful when editing large numbers of source files in the same directory, or to avoid corrupting source files you don't control.

share|improve this answer

Use the "set tabstop=2" option

share|improve this answer
The question was for only one directory. That would change it globally. – Macha May 2 '10 at 11:35

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .