Archive for December, 2010

Stata syntax highlighting for gedit

December 1, 2010 11 comments

For quite a while, I have been looking for a way to enable Stata syntax highlighting in gedit. Today, I stumbled across this thread:

The second poster (jcress410) wrote a .do file that generates the stata.lang file with the gtksourceview/gedit language specs.

Here’s how to make it work under Ubuntu 10.10:

1. Download the stata file & unzip it
2. Change to the unzipped folder and rename file styles to styles.csv
3. Change the value of the working_dir macro in line 9 in the file to the name of the unzipped directory
4. Run in Stata
5. Copy the generated stata.lang file to
/usr/share/gtksourceview-2.0/language-specs (for use by all users on the system, requires superuser privileges)
or to
~/.local/share/gtksourceview-2.0/language-specs (for use with your account only)
For the latter option, you may have to create the directory first:

mkdir -p ~/.local/share/gtksourceview-2.0/language-specs

6. Restart gedit.

.do files are now recognized automatically. For manual selection of the Stata Highlight Mode, go to View > Highlight Mode > Scientific > stata

Many thanks to Justin Cress for writing the syntax to generate the file!! You made my day!

Categories: Science