Post Tue Jan 31, 2012 9:21 am

Syntax highlighting for gedit

I've been surprised that no one yet implemented syntax highlighting of CFDG files for gedit.
So here it is:
cfdg.lang.zip
(1.74 KiB) Downloaded 92 times

To install just extract archive to ~/.local/share/gtksourceview-3.0/language-specs directory.
Adapted for Context Free 3 and gedit 3.

If you have any remarks and suggestions, I'll be glad to hear them.

As a bonus, here are the simple script to make contextfreeing in gedit easier:
  Code:
#!/bin/bash

viewer="eog"
size="700"

cfdg_file="$GEDIT_CURRENT_DOCUMENT_PATH"
png_file="$GEDIT_CURRENT_DOCUMENT_DIR/`basename "$GEDIT_CURRENT_DOCUMENT_NAME" .cfdg`.png"

cfdg "$cfdg_file" "$png_file" -w $size -h $size && $viewer "$png_file"

To use it, choose Tools > Manage External Tools in the menu, click little "+" button and copy-paste this script in the field to the right. Then click "Shortcut Key" field, and press some key combination, for example CTRL+R. When you press it again after closing configuration window, your currently opened file will be rendered by cfdg and result presented to you.