Skip to content

Instantly share code, notes, and snippets.

@bobrocke
Created May 26, 2015 23:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bobrocke/84e5609afd8f0bc08fcb to your computer and use it in GitHub Desktop.
Save bobrocke/84e5609afd8f0bc08fcb to your computer and use it in GitHub Desktop.
Atom Command Registration
activate: function(state) {
this.subscriptions = new CompositeDisposable();
this.subscriptions.add(atom.commands.add('.platform-darwin .tree-view', {
'open-a-terminal:openroot': (function(_this) {
return function() {
return _this.openroot();
};
})(this)
}));
this.subscriptions.add(atom.commands.add('.platform-darwin .tree-view', {
'open-a-terminal:openhere': (function(_this) {
return function() {
return _this.openhere();
};
})(this)
}));
},
@bobrocke
Copy link
Author

This is what worked:

    activate: function(state) {
        var self = this;

        this.subscriptions = new CompositeDisposable();

        this.subscriptions.add(
            atom.commands.add(
                '.tree-view',
                {
                    'open-a-terminal:openroot': function() { return self.openroot();},
                    'open-a-terminal:openhere': function() { return self.openhere();}
                }
            )
        );
    },

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment