The following was derived from the GtkSourceView reference manual, Language Definition v2.0 Tutorial and Reference.
Create the file /usr/share/gtksourceview-2.0/language-specs/screenplay.lang (as root), with the following contents:
<?xml version="1.0" encoding="UTF-8"?>
<language id="screenplay" _name="Screenplay" version="2.0" _section="Markup">
<style id="indent2" _name="2x indented" map-to="def:comment" />
<style id="indent3" _name="3x indented" map-to="def:constant" />
<style id="indent4" _name="4x indented" map-to="def:identifier" />
<style id="intext" _name="INT. or EXT." map-to="def:statement" />
<context id="indent4" style-ref="indent4">
<context id="indent3" style-ref="indent3">
<context id="indent2" style-ref="indent2">
<context id="intext" style-ref="intext">
Make sure the file is world-readable by running
sudo chmod 0644 /usr/share/gtksourceview-2.0/language-specs/screenplay.lang
Restart gedit. Now any file named
*.script that you open in gedit should show the type "Screenplay" in the status bar at bottom. Lines indented with 2, 3, or 4 tabs should be colored blue, magenta, and cyan, respectively, and lines beginning with INT. or EXT. will be red and bold-face.
You can adjust this in a few ways:
.script file name suffix is set on line 5, in the "globs" property. You can change this in the obvious way, and include multiple values if you want, separated by semicolons (
The colors that you get for the indented and INT. and EXT. lines depend on the particular color scheme that you've selected for gedit. They're the colors of the comment, constant, identifier, and statement styles (that's what
map-to="def:comment" etc. do). To get different results, you can change the gedit color scheme (Edit > Preferences > Fonts and Colors), or rearrange the
map-to values in the
<style> tags. If you want more control, you can create your own color scheme as follows:
sudo cp classic.xml screenplay.xml
Edit screenplay.xml (as root). Replace the first three non-comment lines by:
<style-scheme id="screenplay" _name="Screenplay" version="1.0">
<_description>Screenplay color scheme</_description>
Then adjust the colors (and maybe other styles too, e.g.
bold="true") of the def:comment, def:constant, def:identifier, and def:statement styles. Restart gedit again, and change gedit's color scheme to Screenplay to see your new colors. Note that that's a global change though; you may want to change back to your regular color scheme to edit other files.
Note that any time you change the screenplay.lang or screenplay.xml files, you'll have to restart gedit to see the results.