Sunday, June 26, 2011

Re: expandtab not working for Ruby

On 2011-06-26, Marten Veldthuis wrote:
> Weird problem time:
>
> I've got expandtab set in my .vimrc file, but apparently it's not working. I'd
> never really noticed this because somehow it *is* working when I'm in a Rails
> project, but outside of that I still get tab characters.
>
> I've tried grepping for expandtab, or ruby, but I can't figure this one out, so
> I'm hoping someone knows where or how to look. My vimrc is pasted over here:
> https://gist.github.com/1047562

To see if it is really being set in your .vimrc, you can start Vim
with no file name on the command line and execute

:verbose set expandtab?

That will show you where 'expandtab' was set last as well as its
value. You should see this:

expandtab
Last set from ~/.vimrc

Then, when you edit some file and notice that tabs are not being
expanded, execute this:

:verbose set expandtab? filetype?

That will show you the plugin that set it to 'noexpandtab' and will
also show the current 'filetype' which may help in finding the
problem and a solution.

The solution will probably be to identify the filetype plugin that
is setting 'noexpandtab' and to put this line

setlocal expandtab

in a file named

~/.vim/after/plugin/<filetype>.vim

where <filetype>.vim is the name of the offending filetype plugin.

Regards,
Gary

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments:

Post a Comment