Highly Irregular
Highly Irregular

Reputation: 40819

Shortcut to get PhpStorm to wrap or unwrap the current line with /* */ comment tags

Not sure whether there would be an existing shortcut for this or not, but if so, what is it, and if not, how can I create one?

I want it to essentially toggle the wrapping of slash-star comment tags, so if the line is commented already, it becomes uncommented. Eg from:

/*padding-left: 10px;*/

to

padding-left: 10px;

Upvotes: 0

Views: 604

Answers (1)

LazyOne
LazyOne

Reputation: 165511

There are 2 standard actions for working with comments:

  • Comment with Line Comment Ctrl + /
  • Comment with Block Comment Ctrl + Shift + /

CSS does not have single line comments, only block comments, but Comment with Line Comment works just fine: it comments and uncomments current line (or selected lines) by applying or removing comment for each line individually.

Block comment works with selections only and applies single comment to whole selection.

P.S.
Those shortcuts are for Windows using Default keymap. For other OS / keymaps check it in Settings (Preferences on Mac) | Appearance & Behaviour | Keymap (that's for PhpStpm v8.0.2, for 8.0.1 and older the settings path is slightly different)

Upvotes: 2

Related Questions