I'm not sure anyone else has noticed this, but the vim indentation
for ruby is frustrating. It keeps indenting two spaces instead of
tab. Has anyone else experienced this?
(this happens with cindent turned on. I have no such problem with
perl or anything else. ideas?)
db
found the culprit.
/vim/vim61/ftplugin/ruby.vim
had a line with
" Set shift width to 2, the Ruby standard
setlocal sw=2
I didn’t realize this was a ruby standard… hm
···
On Fri, Aug 02, 2002 at 02:53:18AM +0900, Daniel Bretoi wrote:
Hey,
I’m not sure anyone else has noticed this, but the vim indentation
for ruby is frustrating. It keeps indenting two spaces instead of
tab. Has anyone else experienced this?
(this happens with cindent turned on. I have no such problem with
perl or anything else. ideas?)
I’m not sure anyone else has noticed this, but the vim indentation
for ruby is frustrating. It keeps indenting two spaces instead of
tab. Has anyone else experienced this?
:set ts=2
(and :set noet, but that’s the default, I think)
Makes it so your tabs are two spaces, and it indents by these two-space
tabs automatically.
–Evan, who doesn’t want to begin a tabs-vs-spaces argument
There’s obviously no real standard. That is
someone’s tongue-in-cheek opinion, I assume.
Having said that, I concur with his choice…
the code in The Ruby Way is written pretty
consistently in that manner.
Purely a matter of taste. I recall the humorous
post years ago that was supposed to be the
C source code for the universe. The poster,
who had swiped the code from God, commented
“Note that God uses four-space tabs.”
Cheers,
Hal
···
----- Original Message -----
From: “Daniel Bretoi” lists@debonair.net
To: “ruby-talk ML” ruby-talk@ruby-lang.org
Sent: Thursday, August 01, 2002 12:57 PM
Subject: Re: vim indenteation for ruby
found the culprit.
/vim/vim61/ftplugin/ruby.vim
had a line with
" Set shift width to 2, the Ruby standard
setlocal sw=2
After all, it says explicitly in ftplugin/README.txt:
“The default filetype plugin files contain settings that 95% of the
users will want to use. They do not contain personal preferences,
like the value of ‘shiftwidth’.”
And…
How do I get my ftplugin/ruby.vim to be distributed with Vim?
Among other things, it makes matchit work with Ruby.
Note the automatic indenting is set by shiftwidth, which is set to 2 in
the filetype plugin, so if you don’t like the ts of 2, you’ll need to
override it there, either by editing ftplugin/ruby.vim, or creating
~/.vim/ftplugin/ruby.vim yourself.
:help ftplugin
···
Evan Martin (martine@cs.washington.edu) wrote:
Daniel Bretoi wrote:
I'm not sure anyone else has noticed this, but the vim
indentation for ruby is frustrating. It keeps indenting two
spaces instead of tab. Has anyone else experienced this?
After all, it says explicitly in ftplugin/README.txt:
“The default filetype plugin files contain settings that 95% of the
users will want to use. They do not contain personal preferences,
like the value of ‘shiftwidth’.”
And…
How do I get my ftplugin/ruby.vim to be distributed with Vim?
Among other things, it makes matchit work with Ruby.
Contact the current maintainer, I suppose. Failing that, Bram.
If anyone wants to override the sw setting without modifying the “standard”
ruby.vim file, follow these steps:
Edit ~/.vim/ftplugin/ruby.vim
Put your preferences in there
If ~/.vim/ftplugin/ruby.vim already exists, call it “ruby_prefs.vim” or
something instead.
>
> Purely a matter of taste. I recall the humorous
> post years ago that was supposed to be the
> C source code for the universe. The poster,
> who had swiped the code from God, commented
> "Note that God uses four-space tabs." :)
>
Yes, that's true. I received the same revelation.
···
On Thursday 01 August 2002 01:09 pm, Hal E. Fulton wrote:
I don’t mind tab being represented by two spaces, I prefer 3, but sw
actually MAKES an indentation of 2 spaces vs a real tab. That, I do NOT
like. I think keeping tabs instead of spaces allows anyone to set their
tab/space preference. Spaces are much more imposing.
db
···
On Sat, Aug 03, 2002 at 12:10:50AM +0900, Thomas Hurst wrote:
Evan Martin (martine@cs.washington.edu) wrote:
Daniel Bretoi wrote:
I'm not sure anyone else has noticed this, but the vim
indentation for ruby is frustrating. It keeps indenting two
spaces instead of tab. Has anyone else experienced this?
:set ts=2
Note the automatic indenting is set by shiftwidth, which is set to 2 in
the filetype plugin, so if you don’t like the ts of 2, you’ll need to
override it there, either by editing ftplugin/ruby.vim, or creating
~/.vim/ftplugin/ruby.vim yourself.