Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

[vim] using modeline to set procmail filetype

15 views
Skip to first unread message

Troy Piggins

unread,
Oct 13, 2009, 7:28:40 PM10/13/09
to
When I open most common filetypes in vim, the filetype syntax
colours appear as expected. But when I try to open
/etc/procmailrc it just appears as all the one colour, as if the
filetype is not recognised.

In an attempt to get vim to automatically set the ft for it, I
added:

#EOF vim: set ft=procmail :

to the end of the file. But it still will not recognise it.

If I manually type :set ft=procmail in the open file, the syntax
colours do display correctly.

Any ideas?

--
Troy Piggins

Christian Brabandt

unread,
Oct 14, 2009, 2:08:19 AM10/14/09
to
On 2009-10-13, Troy Piggins <usene...@piggo.com> wrote:
> When I open most common filetypes in vim, the filetype syntax
> colours appear as expected. But when I try to open
> /etc/procmailrc it just appears as all the one colour, as if the
> filetype is not recognised.
>
> In an attempt to get vim to automatically set the ft for it, I
> added:
>
> #EOF vim: set ft=procmail :

Could it be, that modelines are disabled for you? Check your modeline
settings:
:verbose set ml? mls?

Anyway, it seems filetype.vim only detects .procmail and .procmailrc as
filetypes. There a couple of possibilities to have that fixed without
modelines. See help new-filetype.

The easiest solution is to create ~/.vim/ftdetect/procmail.vim and enter
au BufNewFile,BufRead procmailrc setfiletype procmail
and restart vim

You can also create your own filetype.vim file in your ~/.vim directory
and enter something like

if exists("did_load_filetypes")
finish
endif
augroup filetypedetect
au! BufRead,BufNewFile procmailrc setfiletype procmail
augroup END

See the help, for more possibilites.


regards,
Christian

Troy Piggins

unread,
Oct 14, 2009, 2:23:48 AM10/14/09
to
* Christian Brabandt wrote :

> On 2009-10-13, Troy Piggins <usene...@piggo.com> wrote:
>> When I open most common filetypes in vim, the filetype syntax
>> colours appear as expected. But when I try to open
>> /etc/procmailrc it just appears as all the one colour, as if the
>> filetype is not recognised.
>>
>> In an attempt to get vim to automatically set the ft for it, I
>> added:
>>
>> #EOF vim: set ft=procmail :
>
> Could it be, that modelines are disabled for you? Check your modeline
> settings:
>:verbose set ml? mls?

:verbose set ml? mls?
nomodeline
modelines=5

I guess not. Checked the help and it seems modeline default is
ON for normal users, OFF for root. I tried opening
/etc/procmailrc as a normal user and indeed it does syntax colour
correctly, so that must be it. I guess.

> Anyway, it seems filetype.vim only detects .procmail and .procmailrc as
> filetypes. There a couple of possibilities to have that fixed without
> modelines. See help new-filetype.
>
> The easiest solution is to create ~/.vim/ftdetect/procmail.vim and enter
> au BufNewFile,BufRead procmailrc setfiletype procmail
> and restart vim
>
> You can also create your own filetype.vim file in your ~/.vim directory
> and enter something like
>
> if exists("did_load_filetypes")
> finish
> endif
> augroup filetypedetect
> au! BufRead,BufNewFile procmailrc setfiletype procmail
> augroup END
>
> See the help, for more possibilites.

Thanks very much for the options, Christian. Certainly should be
able to sort it out from here. Thanks.

--
Troy Piggins

0 new messages