Keybinding for bash script


One thing I’m trying to figure out how to easily do in cloud9 is create a keybinding to run a bash script I wrote that calls astyle on the currently open file.

I’ve been able to partially implement this by creating a runner to call that script, but I can’t find a way to bind that specific runner to a key, such that I could just press ctrl+a to autoformat the document I’m working on. Any guidance on what the best way to achieve this would be?

Another imperfection with the runner is that every time I run it, it modifies the file on disk and then prompts me to reload the document to see the changes. Ideally, it would be nice if that just happened automatically.


the better way is to use init script to add a command with js

    name: "raygunReport",
    bindKey: {win: "ctrl-a", mac: "ctrl-a"}
    exec: function(editor) {
        // save if needed
        services.proc.execFile("astyle", {args: [...]}, function() {
             // reload file once ready

however this will not have the best performance, since it will send whole file back and forth

Eventually it would be best to add support for calling server side formatters to with optimizations similar to those done by jsonalyzer plugin