Skip to content

Instantly share code, notes, and snippets.

@giordanocardillo
Last active March 6, 2017 16:23
Show Gist options
  • Save giordanocardillo/f5c16bc3e5f472a6cdf6acab08493990 to your computer and use it in GitHub Desktop.
Save giordanocardillo/f5c16bc3e5f472a6cdf6acab08493990 to your computer and use it in GitHub Desktop.
Comment toggle trick

So, I guess I'm not the only one that need some way of easily toggling code in and out of the code.

This trick below can be used to toggle between two sets of code, with one symbol in the code with no additional short-keys to learn, and no tool dependencies!

//*                      /*
someCode();              someCode();
/*/                      /*/
someOtherCode();         someOtherCode();
//*/                     //*/

Here is a version for simply commenting code in and out:

Activated:

//*
someCode();
//*/

Deactivated / commented out:

/*
someCode();
//*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment