Syntax highlighting

From DavinciWiki
Revision as of 21:58, 9 December 2010 by Seanm (Talk | contribs)

Jump to: navigation, search

Contents

Summary

When writing scripts for Davinci, you may find it useful to work in an editor with syntax highlighting. Syntax files (which contain the keywords for Davinci) for some text editors are provided below.

PSPad

To get syntax highlighting for Davinci scripts in PSPad:

  • Save File:Davinci.INI to your PSPad syntax directory, which by default is C:\Program Files\PSPad\Syntax.
  • In PSPad, you will have to go to Settings → Highlighters Settings and add Davinci.

Vim

Note: The file and instructions given here are known to work for gVim on a CentOS (Unix) system. Minor tweaks may be needed for other configurations - for instance, if your .vim directory is not in your home directory.

Syntax

  • Save File:Davinci.vim to your .vim directory. (Note: This syntax file was last updated on December 4, 2010, so any functions added since then would not be included in this file.)
  • In order to have Vim recognize files with extensions typically used by Davinci, add the following lines to mysyntax.vim (which should be in your .vim directory):
au BufRead,BufNewFile *.dv set filetype=Davinci
au BufRead,BufNewFile *.dvlog set filetype=Davinci
au BufRead,BufNewFile *.dvrc set filetype=Davinci
au! Syntax Davinci source ~/.vim/Davinci.vim
  • If needed, add the following lines to .vimrc (which should be in your home directory):
let mysyntaxfile = "~/.vim/mysyntax.vim"
syntax on

set runtimepath=~/.vim,$VIMRUNTIME

Colors (optional)

The syntax file provided above should work with any color scheme, but it was written with this color scheme File:lab.vim in mind. To use this color scheme, save it in ~/.vim/colors/ and, if you want it to be the default color scheme, add the following line to mysyntax.vim:

colors lab
Personal tools