Home Download Buy Blog Forum Support

File type specific key bindings

File type specific key bindings

Postby Axsuul on Fri Oct 14, 2011 9:47 am

I want to set key bindings based on file type. Found this http://sublimetext.userecho.com/topic/2 ... thon-code/

However, my attempt doesn't seem to work. The coffeescript macro seems to be overriding the ruby one. Any suggestions? Thanks.

Code: Select all
// ruby specific macros
    // hash rocket
    {
        "keys": ["ctrl+."],
        "command": "run_macro_file",
        "args": { "file": "Packages/User/Ruby/HashRocket.sublime-macro" },
        "context": {
            "key": "selector", "operator": "equal", "operand": "source.ruby"
        }
    },

    // coffeescript macros
    {
        "keys": ["ctrl+."],
        "command": "run_macro_file",
        "args": { "file": "Packages/User/CoffeeScript/Arrow.sublime-macro" },
        "context": {
            "key": "selector", "operator": "equal", "operand": "source.coffeescript"
        }
    }
Axsuul
 
Posts: 9
Joined: Tue Oct 04, 2011 11:51 am

Re: File type specific key bindings

Postby Axsuul on Fri Oct 14, 2011 10:11 am

Sweet, that was it. Thanks!
Axsuul
 
Posts: 9
Joined: Tue Oct 04, 2011 11:51 am

Re: File type specific key bindings

Postby aaandre on Wed Oct 19, 2011 7:43 pm

I am trying to add a hashrocket macro to my install. Would you consider sharing the final key bindings code incl. the context and the macro files? I am trying to create my own macro files but as a newbie I am about to give up.

Thank you!


Axsuul wrote:I want to set key bindings based on file type. Found this http://sublimetext.userecho.com/topic/2 ... thon-code/

However, my attempt doesn't seem to work. The coffeescript macro seems to be overriding the ruby one. Any suggestions? Thanks.

Code: Select all
// ruby specific macros
    // hash rocket
    {
        "keys": ["ctrl+."],
        "command": "run_macro_file",
        "args": { "file": "Packages/User/Ruby/HashRocket.sublime-macro" },
        "context": {
            "key": "selector", "operator": "equal", "operand": "source.ruby"
        }
    },

    // coffeescript macros
    {
        "keys": ["ctrl+."],
        "command": "run_macro_file",
        "args": { "file": "Packages/User/CoffeeScript/Arrow.sublime-macro" },
        "context": {
            "key": "selector", "operator": "equal", "operand": "source.coffeescript"
        }
    }
aaandre
 
Posts: 3
Joined: Wed Oct 19, 2011 6:51 pm


Return to Technical Support

Who is online

Users browsing this forum: Destiner and 18 guests