Search code examples
htmlphpstormjetbrains-ide

PhpStorm - how to highlight code block via keyboard?


Using PhpStorm, how to highlight code block without pressing Shift + Down?

For example

    <div class="form-group">
        <label class="col-sm-3 control-label">Label</label>
        <div class="col-sm-7">
            <div class="checkbox">
                <label><input type="checkbox">Install</label>
            </div>
        </div>
    </div>

If Text-cursor is on the <div class="col-sm-7"> then I like highlight that block:

        <div class="col-sm-7">
            <div class="checkbox">
                <label><input type="checkbox">Install</label>
            </div>
        </div>

Solution

  • Use Ctrl+W (Windows default) or Alt+Up (OS X) to select increasingly expansive scopes. E.g. if the cursor is here at "col-sm":

    <div class="col-sm|-7">
        <div class="checkbox">
            <label><input type="checkbox">Install</label>
        </div>
    </div>
    

    Pressing Ctrl+W once selects all of col-sm-7, pressing it again selects the surrounding quotes, pressing it again the entire attribute, then the entire tag, and finally the tag including its content and closing tag. This works for scopes in all supported languages, not just HTML.