Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 341
spharish Avatar asked Feb 17 '16 11:02

spharish


People also ask

How do I run a shortcut key in Sublime Text?

You can use the shortcut key Ctrl+Shift+Q on Windows and Cmd+Shift+Q for Mac, to play a macro recorded by the user in Sublime Text.

How do I build and run in Sublime Text?

Sublime Text is able to run build programs such as 'make', either when a key in pressed (F7 by default), or when a file is saved. The build system to use can be select from the Tools/Build System menu. If a project is open, the selected build system will be remembered for the project.

What does Ctrl d do in Sublime Text?

Quick Add Next. To add the next occurrence of the current word to the selection, use Quick Add Next, which is bound to Ctrl+D on Windows and Linux, or Command+D on OS X. Again, if you go too far, use Undo Selection (Ctrl+U, or Command+U on OS X) to step backwards.


2 Answers

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 } },
like image 188
r-stein Avatar answered Sep 27 '22 23:09

r-stein


Not answering the question but good to know, F7 functions the same as Ctrl+b.

enter image description here

like image 29
Mark K Avatar answered Sep 27 '22 23:09

Mark K