POV-Ray : Newsgroups : povray.unix : VIM syntax highlighting and .inc files Server Time
28 Jul 2024 16:27:40 EDT (-0400)
  VIM syntax highlighting and .inc files (Message 15 to 24 of 24)  
<<< Previous 10 Messages Goto Initial 10 Messages
From: Warp
Subject: Re: VIM syntax highlighting and .inc files
Date: 28 Nov 2001 16:13:09
Message: <3c055365@news.povray.org>
Mark M. Wilson <mmw### [at] ncsldcrstatencus> wrote:
: Er, what the h#$@ does that mean? (I'm a newbie)  --MMW

  If you press meta-x and write vi-mode, emacs will start acting like vi.

-- 
#macro N(D,I)#if(I<6)cylinder{M()#local D[I]=div(D[I],104);M().5,2pigment{
rgb M()}}N(D,(D[I]>99?I:I+1))#end#end#macro M()<mod(D[I],13)-6,mod(div(D[I
],13),8)-3,10>#end blob{N(array[6]{11117333955,
7382340,3358,3900569407,970,4254934330},0)}//                     - Warp -


Post a reply to this message

From: Mark M  Wilson
Subject: Re: VIM syntax highlighting and .inc files
Date: 28 Nov 2001 16:18:57
Message: <3C0554FF.92FE3F25@ncsl.dcr.state.nc.us>
I take it from the presence of the colon that this is a command issued
while in vim, editing the .inc file?  Or is this a statement to be added
to my ~/.vimrc ?  And if the former, will this be a permanent change (I
hope so)?
Thanks for all this help, guys!
--Mark

Peter Popov wrote:
> 
> On Wed, 28 Nov 2001 15:21:57 -0500, "Mark M. Wilson"
> <mmw### [at] ncsldcrstatencus> 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?
> 
> off the top of my head,
> 
> :syn pov
> 
> Peter Popov ICQ : 15002700
> Personal e-mail : pet### [at] vipbg
> TAG      e-mail : pet### [at] tagpovrayorg


Post a reply to this message

From: Ron Parker
Subject: Re: VIM syntax highlighting and .inc files
Date: 28 Nov 2001 16:32:00
Message: <slrna0alui.q0h.ron.parker@fwi.com>
On Wed, 28 Nov 2001 16:01:51 -0500, Mark M. Wilson wrote:
> OK, then my next (stupid) question is (you can tell I haven't read that
> section of the manual lately):
> when making the include statements, if the .pov file (which used to be
> the .inc file) is not in the same dir. as all the other .inc files which
> come with POVRay, do I explicitly state the path like so:
> #include ~/ceiling.pov  
> 
> or had I better move the ceiling.pov file to /usr/share/povray where all
> the other stuff is?

You can add stuff to the include path by putting something like

library_path=/home/ron/pov-dist/include

in your ~/.povrayrc file.  Then the #include will just work.

Also, I think you'll find that POV's #include statement doesn't understand
shell shortcuts like ~.

-- 
#macro R(P)z+_(P)_(P)_(P+1)_(P+1)+z#end#macro Q(C,T)bicubic_patch{type 1u_steps
6v_steps 6R(1)R(3)R(5)R(7)pigment{rgb z}}#end#macro _(Y)#local X=asc(substr(C,Y
,1))-65;<T+mod(X,4)div(X,4)9>-2#end#macro O(T)Q("ABEFUQWS",T)Q("WSXTLOJN",T)#
end O(0)O(3)Q("JNKLCGCD",0)light_source{x 1}// ron### [at] povrayorg


Post a reply to this message

From: Mark M  Wilson
Subject: Re: VIM syntax highlighting and .inc files
Date: 28 Nov 2001 16:36:40
Message: <3C055926.155A55C8@ncsl.dcr.state.nc.us>
I wondered about that, even as I was typing it....
-MMW

Ron Parker wrote:

> 
> Also, I think you'll find that POV's #include statement doesn't understand
> shell shortcuts like ~.
> 
> --
> #macro R(P)z+_(P)_(P)_(P+1)_(P+1)+z#end#macro Q(C,T)bicubic_patch{type 1u_steps
> 6v_steps 6R(1)R(3)R(5)R(7)pigment{rgb z}}#end#macro _(Y)#local X=asc(substr(C,Y
> ,1))-65;<T+mod(X,4)div(X,4)9>-2#end#macro O(T)Q("ABEFUQWS",T)Q("WSXTLOJN",T)#
> end O(0)O(3)Q("JNKLCGCD",0)light_source{x 1}// ron### [at] povrayorg


Post a reply to this message

From: Adrien Beau
Subject: Re: VIM syntax highlighting and .inc files
Date: 28 Nov 2001 18:13:29
Message: <3C056FB5.6D60C32A@free.fr>
"Mark M. Wilson" wrote:
> 
> I take it from the presence of the colon that this is a command issued
> while in vim, editing the .inc file?

Correct.

> Or is this a statement to be added
> to my ~/.vimrc ?

No.

> And if the former, will this be a permanent change

No. But at least it works, if you're in a rush.

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


Post a reply to this message

From: Adrien Beau
Subject: Re: VIM syntax highlighting and .inc files
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

From: Steve
Subject: Re: VIM syntax highlighting and .inc files
Date: 28 Nov 2001 18:46:49
Message: <slrna0atoo.890.steve@zero-pps.localdomain>
Make a copy of filetype.vim before you go making the
changes, it might come in handy if you mess up while
editing. 

--
Cheers
Steve              email mailto:ste### [at] zeroppsuklinuxnet

%HAV-A-NICEDAY Error not enough coffee  0 pps. 

web http://www.zeropps.uklinux.net/

or  http://start.at/zero-pps

 11:44pm  up 51 days, 15:29,  1 user,  load average: 1.00, 1.00, 1.02


Post a reply to this message

From: Mark M  Wilson
Subject: Re: VIM syntax highlighting and .inc files
Date: 29 Nov 2001 22:57:52
Message: <3c0703c0@news.povray.org>
Thanks!  I did something like what you suggested, and added the line:
set ft=inc 
right under the previous line, where it said set ft=pov
and that seems to have done the trick just fine.

--Mark


Post a reply to this message

From: Anthony Thyssen
Subject: Re: VIM syntax highlighting and .inc files
Date: 9 Jul 2002 10:27:35
Message: <3D2AF312.CFDEFDF8@cit.gu.edu.au>
Adrien Beau wrote:
> 
> "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
> ...
> " Povray or IA64
> au BufNewFile,BufRead *.inc                     set ft=pov
> 
> Brutal but efficient. Hope this helps.
> 

Applogies for replying 6 months later to this problem, but as a fairly
heavy
user of vi and vim, and no one coming up with the better solutions, I
had to
say something..

First DO NOT EDIT "filetype.vim", you are asking for trouble with
upgrades.

Instead add that line to your ".vimrc" file in your home directory.

If you have other types of ".inc" files you can also add to your  povray
scene files the comment
   // vim:set syntax=pov:

This line must be either within the first five lines of either the top
or
the bottom of your ".inc" file.  I use this a alot on "unusal" files,
and work very well in telling vim just what syntax highlighing it should
use, in unusal cases.

  Anthony Thyssen ( System Programmer )   
http://www.sct.gu.edu.au/~anthony/

-----------------------------------------------------------------------------
    The Number of the Editor --  Vi Vi Vi

-----------------------------------------------------------------------------
     PGP Public Key available -- finger -l ant### [at] lyrchcitgueduau


Post a reply to this message

From: Florian Pesth
Subject: Re: VIM syntax highlighting and .inc files
Date: 9 Jul 2002 10:55:19
Message: <3d2af957$1@news.povray.org>
Oh I missed that thread! I have asked a similar question in reply to a
thread in povray.programming, but got no answer. BTW is it possible with
emacs to export the syntax highlighting into an HTML file? IMO this is the
main argument vor using vim instead of emacs. (I have also Windows versions
of both editors installed. Works well! So this is not a "unix" specific
topic.)
Regards,
Florian


Post a reply to this message

<<< Previous 10 Messages Goto Initial 10 Messages

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