Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to define per-project key bindings?

Tags:

sublimetext2

Currently I define shortcuts for build variants in my global config. Is there a way to do the same, but using <my-project>.sublime-project config file?

I tried to define them inside "settings" field - didn't work:

"settings": [
  { "keys": ["ctrl+shift+a"], "command": "build", "args": {"variant": "my_variant"} }
]
like image 841
Fred K Avatar asked Sep 24 '13 12:09

Fred K


1 Answers

I don't think there is a way to define keymaps outside of .sublime-keymap files, which AFAIK need to be stored under the Packages hierarchy - for example, in Packages/User/Default (<your OS>).sublime-keymap, as Sublime ignores keymap files with other names.

However, for what you're trying to do, there is a workaround. The .sublime-project file supports a "build_systems" setting:

"build_systems":
[
    {
        "name": "List",
        "cmd": ["ls"]
    }
]

By appropriately modifying this on a per-project basis you can enable the Automatic build system and have your specified one run when you hit CtrlB. More information on build systems is available here.

like image 103
MattDMo Avatar answered Oct 20 '22 21:10

MattDMo