Search code examples
sublimetext2keyboard-shortcutssublimetext3sublimetextshortcut

In Sublime Text 3, how to have shortcuts for "Build and Run" and "Build only" separately like it was in Sublime Text 2?


In Sublime Text 3,when we press Ctrl+Shift+B, we are given the option to either do "Build and Run" or "only Build", whereas Ctrl+B executes the previously chosen operation among the two. But I want it to be like, it should directly build and run when I press Ctrl+Shift+B and only build when I press Ctrl+B like it was in Sublime Text 2. Can someone help me out?


Solution

  • Addings this to your sublime-keymap should result in the expected behavior:

    { "keys": ["ctrl+b"], "command": "build", "args": { "variant": "" } },
    { "keys": ["ctrl+shift+b"], "command": "build", "args": { "variant": "Run" } },
    

    However you might want to remap keep the list of options to alt+b:

    { "keys": ["alt+b"], "command": "build", "args": { "select": true } },