Main Page | Report this Page
Computers Forum Index  »  Computer - Editors  »  [vim] using modeline to set procmail filetype...
Page 1 of 1    

[vim] using modeline to set procmail filetype...

Author Message
Troy Piggins...
Posted: Wed Oct 14, 2009 3:28 am
Guest
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...
Posted: Wed Oct 14, 2009 10:08 am
Guest
On 2009-10-13, Troy Piggins <usenet-0910 at (no spam) piggo.com> wrote:
Quote:
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...
Posted: Wed Oct 14, 2009 10:23 am
Guest
* Christian Brabandt wrote :
Quote:
On 2009-10-13, Troy Piggins <usenet-0910 at (no spam) 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.

Quote:
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
 
 
Page 1 of 1    
All times are GMT
The time now is Mon Nov 30, 2009 2:31 am