Skip to end of metadata
Go to start of metadata


In this recipe we show how a Ruble command can be triggered when an editor saves its content. This allows for processing to occur immediately after the file has been saved.

The Code

In the snippet below, we register our command with the "execution listener". When that listener encounters an event with the "" id, the command will be triggered. Inside the invocation block, we see that the context contains an "execution_listener" property which is a hash of properties being sent with the event. All key/value pairs are emitted to the console. To perform your own post-save processing, simply replace the CONSOLE.puts line with the appropriate code.

NOTE: In order to get an idea of what events are available, simply remove the "" argument from the trigger assignment. This will cause the command to trigger for all execution listener events.

An Example

A script which takes the current file and makes a backup in a specific spot.

  • No labels