Spoiler alert: This solution for screenplay syntax highlighting sucks and I wouldn’t use it if my life depended on it.
It hardly qualifies as a solution because many important aspects of a proper screenplay document are ignored by using this approach. But it’s nice to have learned something new about one of my favorite lightweight text editors. Custom syntax highlighting might come in handy in future projects.
I added the following snippet to my
.nanorc configuration file. It’s located in the
/etc directory. If it doesn’t exist you can simply create it.
set autoindent set tabsize 8 # The file extension to be matched with the syntax rules described below syntax "fksp" "\.fksp$" # Screenwriting terminology (not complete) color cyan "AERIAL SHOT|ANGLE ON|CLOSE ON|CLOSEUP|CLOSER ANGLE|CONTINUOUS|CROSSFADE|CUT TO|DISSOLVE TO|ESTABLISHING SHOT|FADE TO|FADE IN|FLASH CUT|FLASHBACK|FREEZE FRAME|INSERT|INT|INTO VIEW|JUMP CUT TO|POV|PULL BACK|PUSH IN|REVERSE ANGLE|SPLIT SCREEN SHOT|TIGHT ON|ZOOM" # Directions, e.g. We see her PANTING after escaping her killer. color brightcyan "\s\b[A-Z][A-Z]+\b\s" # Names (uppercase and follow by a colon) color yellow "[A-Z][A-Z]+:" # Spoken text (anything between "") color brightyellow start="\"" end="\""
Starting nano with the same options I mentioned in this post adds line numbers and softwrapping.
$ nano -wl$ screenplay_test.fksp
The file extension must match the one specified in the configuration file. In my case that’s
*.fksp. The result looks like this.
The following colors can be used for syntax highlighting in GNU nano: white, black, red, blue, green, yellow, magenta, and cyan. Additionally, those colors can be prefixed with “bright” to make them brighter, e.g. brightyellow instead of yellow.
Click here to learn more about all the cool things you can do with the
.nanorc configuration file.