I got an email the other day updating me on the Chocolat text editor, and how it's officially at version 1.0.
I gave it a shot, and it's a really solid editor. I suppose I like it so much due to it's simplicity. Not many options, or configurations, just the editor.
Anyway, as a a faithful Coda user for years, I got
accustomed to the shortcut keys, but more than anything, the
plugins architecture. I've created two
plugins. One simply truncates bodies of text to 80 characters, while the other
runs an rsync
script that pushes the contents of a directory to a
Parallels VM I have running.
While Chocolat doens't (yet) have a plugin system, I was able to find a workaround using a technique I saw on on Super User.
It addresses the question: osx snow leopard - Starting application with custom keyboard shortcut
While the full example is pretty thorough, I wanted to walk through the process I undertook to have some bash code/script run through a shortcut key. I'm going to split this into two pieces.
Creating a Service
From any application, you can go to the Application Menu
, down to Services
and choose one. These services can do a variety of things, such as copy/paste
the open file's text, upload the file through an FTP application, etc.
We want to create a service that runs a bash command/script.
- Prepare the bash command and test it in
Terminal.app
- Open up
Automator.app
- Create a new
Service
- In the left column, under the
Library
header, choose theUtilities
option - In the column to the right, double-click the
Run Shell Script
option - Paste your command into the textarea
- Above, under the Service received selected drop-down list, choose
no input
- Hit
Command-S
to save it, and give it a name (in my case "rsync")
Creating the shortcut key
Now that the service has been created, we want to make sure it is both
accessible through the the Services
submenu, as well as having a shortcut key
bound to it.
Here are the steps to do both:
- Open up
System Preferences.app
- Go to the
Keyboard
settings - On the left, choose the
Services
option - Scroll to the bottom, and ensure the
rsync
(or whatever name you gave it) option is checked - When selecting the service, a button titled
add shortcut
should become visible. Choose this, and add your shortcut
As it often the case, I hope this post reminds me of the process later on, say after a reformat, and that it helps others trying to do the same :)