Oct 07
Stata Bundle for Textmate
Working with Stata’s do file editor is one of the most painful exercises. The lack of syntax highlighting means a large do file is basically unreadable. Enter TextMate. One can edit and send .do files to Stata directly from a Textmate project. If you have the standard Stata Intercooled, then download and install the Stata bundle. Next, go to “Bundles –> Bundle Editor –> Show Bundle Editor” and find the Stata bundle. Select the “Send File to Stata” command and edit the first line “StataMP” to read “Stata.” Do the same with the “Send Selection to Stata.” Now open Stata, cd to the project directory, open your do file in TextMate and start editing. Bask in the glory that is syntax-highlighting.

August 7th, 2008 at 11:06 pm
Thank you for the post and the bundle – it indeed makes life easier. Do you think there is a way to make Stata, via TextMate/AppleScript, come back to the project directory after a do-file or a part of the do-file contained another cd command? Sometimes data folders and project folder does not coincide. As a result one needs to cd to the project directory each time a directory was changed.
Thanks,
Ivan
October 17th, 2008 at 2:29 pm
I was struggling with the same problem and it took me a nearly a whole day to figure out what the problem was.
Here is a solution:
Change this code in Textmate
Bundles:Bundles Editor: Show Bundles Editor:Stata:Sent Selection to Stata
you have to replace it with this so that the .do file with the selection is stored at a specific location.
echo “$TM_SELECTED_TEXT” > “/Users/username/Documents/temp/textmatetostata.do”
osascript -e “tell application \”StataSE\”
activate
open POSIX file \”/Users/username/Documents/temp/textmatetostata.do\”
end tell”
February 18th, 2009 at 9:20 am
Hi! I really enjoy using textmate with Stata on Mac. There is something I would like to do though and I don’t know how. I’d like to create my own do-file template so that when I create a new do-file (using “New from Template”), the date is automatically adjusted and some basic command lines are already written, etc…
I have tried to go through the Bundle Editor but can’t get my way through…any help greatly appreciated!
May 24th, 2009 at 1:13 pm
Neat – any chance of getting ‘preserve’ to highlight all commands until the next ‘restore’? Would be handy when generating lots of graphs.
B