Open a file from Terminal with Coda
If you’re like me, you love Coda. Well, you may find the need to open a file, or set of files, from Terminal in Coda. Gregory Tomlinson has created a bash script to let you do just that.
Update May 20, 2011: It turns out that Tomlinson’s website is down. So, here is a brief synopsis of what you can do to add this functionality to your Mac.
- Open Terminal
- In terminal, enter: open .profile
- Add the following lines of code
# TextMate
# set path and simple shell function
export TEXTMATE_PATH=/Applications/TextMate.app/Contents/Resources/mate
mate () {
$TEXTMATE_PATH $1 $2 $3 $4 $5 $6
}
# svn for TextMate (default editor, end-of-line types)
export EDITOR="$TEXTMATE_PATH -w"
export LC_CTYPE=en_US.UTF-8
# Coda
# set path
export CODA_PATH=/Applications/Coda.app
# function roughly like 'mate .' by expanding '.' to '*.htm*'
coda () {
if [[ "." == $1 ]]
then
open -a $CODA_PATH *.htm*
else
open -a $CODA_PATH $1 $2 $3
fi
}
- Save .profile
- Quit Terminal
- Restart Terminal
There is also a slightly more robust script written for Coda by Aditya Bhargava that handles a few more tidbits and it is available on GitHub.
[ad#Adsense: Horiz 468]