POV-Ray : Newsgroups : povray.unix : VIM syntax highlighting and .inc files : Re: VIM syntax highlighting and .inc files Server Time
28 Jul 2024 18:17:43 EDT (-0400)
  Re: VIM syntax highlighting and .inc files  
From: Adrien Beau
Date: 28 Nov 2001 18:29:17
Message: <3C057367.73EE2512@free.fr>
"Mark M. Wilson" wrote:
> 
> Does any one who uses vim know how to get it to use the same povray
> syntax color scheme for .inc files as for .pov files?  When editing my
> .pov files at a console (Debian Linux, BTW) I get my colors, but when
> editing my own custom .inc files, I just get the usual light grey text
> and black background.  Is there some config file I can edit to get vim
> to recognize that .inc files should be treated the same as .pov?

This perhaps depends of the version of Vim you are using.
Use :version to see which one you have. My answer should
work at least for Vim 5.8 and 6.0.

So, is there any config file you can edit?

Yes, there is, and the file is $VIMRUNTIME/filetype.vim
(that is, e.g, /usr/local/share/vim/vim58/filetype.vim).

Searching for the word "pov" in that file (with "/pov")
leads us to these lines:

" Povray
au BufNewFile,BufRead *.pov                     set ft=pov

which almost clearly associate the filetype "pov" to any
files with names ending in .pov.

If you look a few lines below, you'll see that *.inc is
problematic: it can be a POV-Ray include, or an assembler
include, or a PHP include (and I have also used that
extension for Fortran includes).

So, there is some vim-script code to try to guess whether
an .inc file is an assembly or POV-Ray file. It seems it
doesn't work, at least in your case.

If you don't use assembly or PHP, I suggest you modify
the following lines

" Povray or IA64
au BufNewFile,BufRead *.inc                     call FTCheck_inc()

to look like

" Povray or IA64
au BufNewFile,BufRead *.inc                     set ft=pov

Brutal but efficient. Hope this helps.

-- 
Adrien Beau   adr### [at] freefr   http://adrien.beau.free.fr/


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.