expandtab not effected by the mode line

379 views
Skip to first unread message

Charles Smith

unread,
Apr 15, 2008, 4:20:27 AM4/15/08
to vim...@googlegroups.com
I have the following modeline at line 1:

/* vim: set noexpandtab */

and the following line in .vimrc:

set redraw ai sw=4 ic magic ruler modelines=3 t_ti= t_te= expandtab

I'm *not* getting an error on the mode line.  Could it be that expandtab is ignored on modelines?

 

Benjamin Fritz

unread,
Apr 16, 2008, 10:38:42 AM4/16/08
to vim...@googlegroups.com
> &nbsp

I think you want:

/* vim:noexpandtab */

Ben Schmidt

unread,
Apr 16, 2008, 10:49:02 AM4/16/08
to vim...@googlegroups.com
Charles Smith wrote:
> I have the following modeline at line 1:
>
> /* vim: set noexpandtab */

It is not a valid modeline.

Either remove the word 'set' and put the comment closer on a new line or add a
colon at the end of the modeline part:

/* vim: noexpandtab
*/

or

/* vim: set noexpandtab : */

Ben.


Gene Kwiecinski

unread,
Apr 16, 2008, 11:56:28 AM4/16/08
to vim...@googlegroups.com
>I have the following modeline at line 1:
>/* vim: set noexpandtab */
>I'm *not* getting an error on the mode line. Could it be
>that expandtab is ignored on modelines?

Doesn't look like a valid modeline to me. I always preferred that
format as you have above, but you gotta tell 'vim' when to *stop*, so I
had to use

/*
vim: et
*/

or similar (no "set", more later), which I *don't* like because it takes
up >1line, and

/* vim: et
*/

which just plain looks lopsided.

If my old compiler wouldn't grok lines like

// vim: et

you *can* stop it with a ':', like

/* vim: et: */

which should work.

Oh, and you just list the options, no "set". That's implicit in the
modeline itself, iirr.

Anyway, go crazy...

Tony Mechelynck

unread,
Apr 16, 2008, 6:37:51 PM4/16/08
to vim...@googlegroups.com

no, actually he should use one of

// vim: noexpandtab
or


/* vim: noexpandtab
*/
or

/* vim: set noexpandtab :*/

(see ":help modelines"): the first form (without "set") admits of no
text after the modeline on the same line. With "set", the modeline ends
in a colon, and there may be non-modeline text after the colon.

Best regards,
Tony.
--
Then a man said: Speak to us of Expectations.

He then said: If a man does not see or hear the waters of the Jordan,
then he should not taste the pomegranate or ply his wares in an open
market.

If a man would not labour in the salt and rock quarries then he should
not accept of the Earth that which he refuses to give of himself.

Such a man would expect a pear of a peach tree.
Such a man would expect a stone to lay an egg.
Such a man would expect Sears to assemble a lawnmower.
-- Kehlog Albran, "The Profit"

Benjamin Fritz

unread,
Apr 17, 2008, 10:09:26 AM4/17/08
to vim...@googlegroups.com
On 4/16/08, Tony Mechelynck <antoine.m...@gmail.com> wrote:
>
> On 16/04/08 16:38, Benjamin Fritz wrote:
> > On 4/15/08, Charles Smith<cts.p...@yahoo.com> wrote:
> >> I have the following modeline at line 1:
> >>
> >> /* vim: set noexpandtab */
> >>
> >> and the following line in .vimrc:
> >>
> >> set redraw ai sw=4 ic magic ruler modelines=3 t_ti= t_te= expandtab
> >>
> >> I'm *not* getting an error on the mode line. Could it be that expandtab is
> >> ignored on modelines?
> >>
> >>
> >> &nbsp
> >
> > I think you want:
> >
> > /* vim:noexpandtab */
> >
>
>
> no, actually he should use one of
>
> // vim: noexpandtab
> or
>
> /* vim: noexpandtab
> */
> or
> /* vim: set noexpandtab :*/
>
>
> (see ":help modelines"): the first form (without "set") admits of no
> text after the modeline on the same line. With "set", the modeline ends
> in a colon, and there may be non-modeline text after the colon.
>
> Best regards,
> Tony.

Yes, my mistake. I realized this after the other posts...I've only
ever used a modeline once, and then it was in a big header comment
block, so I didn't need to worry about the closing */ on the same
line.

Reply all
Reply to author
Forward
0 new messages