Jump to content

VIM syntax script for vfl?


TheUsualAlex

Recommended Posts

Hi Alex,

I just use the C++ syntax since they're close enough (for my taste anyway) -- plus I'm too lazy to actually write a syntax file :P . It won't support the extended data types (like 'vector' and 'matrix'), but overall it's good enough (and I'm used to it).

A quick and hacky way to get it to auto-detect .vfl files and assign them a C++ syntax, would be to add a file to your ~/.vim directory called "filetype.vim". In that file you can add something like the following:

" my filetype file
if exists("did_load_filetypes")
   finish
endif
augroup filetypedetect
   au! BufRead,BufNewFile *.vfl     setfiletype cpp
   au! BufRead,BufNewFile *.sl      setfiletype cpp
augroup END

... which would give C++ syntax highlighting to both .vfl and .sl (RMan Shading Language) files.

Cheers!

Link to comment
Share on other sites

Hi Alex,

I just use the C++ syntax since they're close enough (for my taste anyway) -- plus I'm too lazy to actually write a syntax file  :P . It won't support the extended data types (like 'vector' and 'matrix'), but overall it's good enough (and I'm used to it).

Aaah. Hadn't thought about that one for some reason. :blink: That ought to save me some time to sleep. :D

Thanks as usual, Mario! :)

Heh. Just tried it. I guess I probably should just add a couple of things in conjunction to the cpp syntax. Shouldn't be too difficult to get all the VEX keywords highlighted.

Edited by TheUsualAlex
Link to comment
Share on other sites

  • 3 years later...
  • 11 months later...
  • 3 years later...

This is an old post, but I'm hoping someone can still help. I've downloaded the above vfl.vim file. Now what to do with it??? I've tried putting it in the Vim home directory also the Syntax directory. Nothing seems to work. Any ideas???

 

Many thanks,

 

WD

Link to comment
Share on other sites

Thanks Edward!

 

I must still be missing something though! I created a file, vfl.vim, in the ftdetect directory and added this line to it -

au BufRead,BufNewFile *.stc set filetype=vfl

I then edited the filtype.vim file to contain the line -

 

au BufRead,BufNewFile *.stc setfiletype .vfl

 

 

When I load a VEX script in to Vim and select 'syntax hilghliting' it responds with 'filetype unknown'.

 

I'm quite new to the whole scripting area so forgive my ignorance.

 

Many thanks,

 

WD

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...