[vim] using modeline to set procmail filetype

[vim] using modeline to set procmail filetype

Post by Troy Piggi » Thu, 15 Oct 2009 08:28:40


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
 
 
 

[vim] using modeline to set procmail filetype

Post by Christian » Thu, 15 Oct 2009 15:08:19


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

 
 
 

[vim] using modeline to set procmail filetype

Post by Troy Piggi » Thu, 15 Oct 2009 15:23:48

* Christian Brabandt wrote :


: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.


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

--
Troy Piggins