In-File Directives Not Applying

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

In-File Directives Not Applying

Andre Nicholson

Where, previously in Vim 7.0, I was able to put Vim commands within files to alter
configuration at runtime, in 7.1 I can't seem to get this feature working.

For example, if I leave a comment such as

# vim: set syntax=sh:

near the top or bottom of a file, it doesn't seem to apply when loading Vim. Has
something changed?

Thanks

Andre Nicholson


--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: In-File Directives Not Applying

Tony Mechelynck

Andre Nicholson wrote:

> Where, previously in Vim 7.0, I was able to put Vim commands within files to alter
> configuration at runtime, in 7.1 I can't seem to get this feature working.
>
> For example, if I leave a comment such as
>
> # vim: set syntax=sh:
>
> near the top or bottom of a file, it doesn't seem to apply when loading Vim. Has
> something changed?
>
> Thanks
>
> Andre Nicholson


No. See
        :help modeline
        :help 'modeline'
        :help 'modelines'


Best regards,
Tony.
--
The polite thing to do has always been to address people as they wish
to be addressed, to treat them in a way they think dignified.  But it
is equally important to accept and tolerate different standards of
courtesy, not expecting everyone else to adapt to one's own
preferences.  Only then can we hope to restore the insult to its proper
social function of expressing true distaste.
                -- Judith Martin, "Miss Manners' Guide to
                   Excruciatingly Correct Behavior"

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: In-File Directives Not Applying

Charles E Campbell Jr
In reply to this post by Andre Nicholson

Andre Nicholson wrote:

>Where, previously in Vim 7.0, I was able to put Vim commands within files to alter
>configuration at runtime, in 7.1 I can't seem to get this feature working.
>
>For example, if I leave a comment such as
>
># vim: set syntax=sh:
>
>near the top or bottom of a file, it doesn't seem to apply when loading Vim. Has
>something changed?
>  
>
I suspect you want

# vim: set ft=sh:

with set syntax, you can either set it ON or OFF (see :help 'syntax').

Regards,
Chip Campbell


--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: In-File Directives Not Applying

Tony Mechelynck

Charles E Campbell Jr wrote:

> Andre Nicholson wrote:
>
>> Where, previously in Vim 7.0, I was able to put Vim commands within files to alter
>> configuration at runtime, in 7.1 I can't seem to get this feature working.
>>
>> For example, if I leave a comment such as
>>
>> # vim: set syntax=sh:
>>
>> near the top or bottom of a file, it doesn't seem to apply when loading Vim. Has
>> something changed?
>>  
>>
> I suspect you want
>
> # vim: set ft=sh:
>
> with set syntax, you can either set it ON or OFF (see :help 'syntax').
>
> Regards,
> Chip Campbell

Sorry, Dr. Chip, but for once you're mistaken: 'syntax' is a string option.

You can do:

        :set syntax=sh
or
        :syntax on
or
        :syntax off

but if you do
        :set syntax
Vim will tell you the current value, and on
        :set nosyntax
you'll get an error.



Best regards,
Tony.
--
FATHER: We are here today to witness the union of two young people in the
         joyful bond of the holy wedlock.  Unfortunately, one of them, my son
         Herbert, has just fallen to his death.
    [Murmurs from CROWD;  the BRIDE smiles with relief, coughs.]
                  "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: In-File Directives Not Applying

Charles E Campbell Jr

Quoting Tony Mechelynck <[hidden email]>:

>
> Charles E Campbell Jr wrote:

> > I suspect you want
> >
> > # vim: set ft=sh:
> >
> > with set syntax, you can either set it ON or OFF (see :help 'syntax').

> Sorry, Dr. Chip, but for once you're mistaken: 'syntax' is a string option.
>
> You can do:
>
> :set syntax=sh
> or
> :syntax on
> or
> :syntax off
>
> but if you do
> :set syntax
> Vim will tell you the current value, and on
> :set nosyntax
> you'll get an error.

You're right -- sorry about that.  I was looking at the point where it
said:  set syntax=ON  vs  set syntax=OFF .

Regards,
Chip Campbell


--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---