Florian Brucker

Vim Syntax File for Context Free

[Tags of this page:] [show similar pages]
last update on 2009-03-14

This is a syntax highlighting file for the popular editor Vim which adds support for the Context Free language (CFDG). Below you can see a screenshot of a cfdg file highlighted using the syntax file with the image viewer open (showing a cfdg by geti).

screenshot

Installation

Installing this syntax file works the same as installing any syntax file for Vim. It's descibed in chapter 44.11 of the Vim documentation (use :help 44.11 inside Vim). The following installation instruction is for Linux/Unix/etc.

  1. Create the directory ~/.vim/syntax if it doesn't exist
  2. Copy the syntax file into that directory

This is a good time to configure the syntax file to suit your needs (path to image viewers, etc.). Read the comments in the file for details. You can then enable the syntax file for the current buffer using :set syntax=cfdg. If you want the syntax file to be enabled automatically for all files with a .cfdg ending, add the following lines to your ~/.vimrc and restart Vim:

augroup filetypedetect
au BufNewFile,BufRead *.cfdg setf cfdg
augroup END
filetype plugin on

Usage

In addition to pure syntax highlighting, this syntax file provides some basic commands to run cfdg on the file you are currently editing. They are accessible via different keyboard shortcuts:

\cc
Compiles the current cfdg file. Note that any changes since the last save are not taken into account.
\cv
Same as \cc, but asks for a variation code first.
\cd
Displays the last image produced by \cc or \cv.
\cb
Like \cc followed by \cd.
\ca
Like \cv followed by \cd.

Note that you may have to configure some settings (e.g. paths to image viewers) before everything works. See the comments in the syntax file for details.

Download

The current version is 0.3. It is released under the Vim license. Any comments/ideas/bug reports are greatly appreciated!