开发者

How to comment multiple lines in PhpStorm IDE?

I use PhpStorm to edit PHP files and configuration files for Apache. How to comment on the s开发者_JS百科elected block and set the symbol comment? I want,for example,

   <Directory />
        Options FollowSymLinks
        AllowOverride None
        Order deny,allow
        Deny from all
    </Directory>

to

   #<Directory />
   #    Options FollowSymLinks
   #    AllowOverride None
   #    Order deny,allow
   #    Deny from all
   #</Directory>


Select multiple lines and use the Comment with Line Comment (Ctrl+/ in the default keymap on Windows, can be changed in Settings | Keymap).

There is also Comment with Block Comment that works for file types that have special style comment for code blocks (not applicable for .htaccess).


There are two possibilities (in cases where block of comment are available like php, json etc files)

First
Windows: Ctrl+/
Mac: +/

will produce

// comment

Second
Windows: Ctrl+Shift+/
Mac: ++/

will produce

/* comment */


For European keyboard you need to add a new shortcut:

  1. Go to Preferences > Keymap
  2. Here search for "comment"
  3. Right click on your action (ie. "Comment with line comment") and choose Add keyboard shortcut
  4. Now digit on keyboard your wanted shortcut (for Mac CMD + SHIFT + 7) and OK, that's it


in mac :

block some lines of codes
command + /
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜